How to plot an integral a function handle

6 visualizaciones (últimos 30 días)
Johan Johan
Johan Johan el 6 de Mayo de 2018
Comentada: Fanzheng Liu el 13 de Nov. de 2021
I want to plot an integral function, if 'y' is an arbitrary vector ,
N=51;
I=@(x)norm(exp(-1i*pi*x)- y'.*exp(-1i*pi*x*(0:(N-1)))).^2;
F=integral(I,-1,1,'ArrayValued',true);
plot(F);
This what I've tried, but it's not working.

Respuesta aceptada

Star Strider
Star Strider el 6 de Mayo de 2018
I am not certain what you want.
Try this:
N = 51;
I = @(x,y) norm(exp(-1i*pi*x)- y'.*exp(-1i*pi*x*(0:(N-1)))).^2;
F = @(y) integral(@(x) I(x,y), -1, 1,'ArrayValued',true);
y = 1:10;
Fy = arrayfun(F, y);
figure(1)
plot(y, Fy)
grid
  1 comentario
Fanzheng Liu
Fanzheng Liu el 13 de Nov. de 2021
Thank you so much for your code... It really really helped me A LOT!!! 🥺🥺🥺

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by