theta=-2*pi:0.001:2*pi;
A(theta)= 1+exp(j.*(pi/3)-j*(3*pi/4)*cos(theta))+exp(-j.*(pi/3)-j*2*(3*pi/4)*cos(theta));
AF(theta) = abs(A(theta));
plot(theta,AF(theta));
Array indices must be positive integers or logical values.
Error in Untitled (line 2)
A(theta)= 1+exp(j.*(pi/3)-j*(3*pi/4)*cos(theta))+exp(-j.*(pi/3)-j*2*(3*pi/4)*cos(theta));

 채택된 답변

Star Strider
Star Strider 2021년 3월 23일

0 개 추천

Create ‘A’ and ‘AF’ as anonymous functions:
theta=-2*pi:0.001:2*pi;
A = @(theta) 1+exp(j.*(pi/3)-j*(3*pi/4)*cos(theta))+exp(-j.*(pi/3)-j*2*(3*pi/4)*cos(theta));
AF = @(theta) abs(A(theta));
figure
plot(theta,AF(theta));
See the documentation on Anonymous Functions for an extended discussion.

댓글 수: 2

srabonty soily
srabonty soily 2021년 3월 23일
thank you
Star Strider
Star Strider 2021년 3월 23일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2021년 3월 23일

댓글:

2021년 3월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by