How to plot an integral a function handle

6 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2018-5-6
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 个评论
Fanzheng Liu
Fanzheng Liu 2021-11-13
Thank you so much for your code... It really really helped me A LOT!!! 🥺🥺🥺

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by