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));

 Respuesta aceptada

Star Strider
Star Strider el 23 de Mzo. de 2021
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 comentarios

srabonty soily
srabonty soily el 23 de Mzo. de 2021
thank you
Star Strider
Star Strider el 23 de Mzo. de 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 23 de Mzo. de 2021

Comentada:

el 23 de Mzo. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by