MATLAB Answers

How to plot an integral a function handle

조회 수: 9(최근 30일)
I want to plot an integral function, if 'y' is an arbitrary vector ,
I=@(x)norm(exp(-1i*pi*x)- y'.*exp(-1i*pi*x*(0:(N-1)))).^2;
This what I've tried, but it's not working.

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 6 May 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);
plot(y, Fy)

  댓글 수: 0

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by