Hi, I am trying to plot the following equation. Its showing error in mod function. Kindly clarify me how to use the mod function to get the proper output.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Anu G
el 24 de Dic. de 2018
Comentada: madhan ravi
el 27 de Dic. de 2018
theta=0:10:90;
rho=0.465;
%d=25; wrong
%k=0.99*(1+(1i*0.66)) ;
k=real(0.97+0.6402i);
poftheta=sqrt((k.^2)-(cos(theta).^2));
y=(rho*sin(theta))./(poftheta);
roftheta=((y-1)/(y+1));
r0=-20*log10(mod(roftheta));
hold on
grid on
plot(theta,r0)
0 comentarios
Respuesta aceptada
madhan ravi
el 24 de Dic. de 2018
Editada: madhan ravi
el 24 de Dic. de 2018
It should be abs instead of mod (assuming that you want to convert the negative sign to positive sign ? )
theta=0:10:90; % Note: if you reduce the step size you will get a smoother plot
rho=0.465;
%d=25; wrong
%k=0.99*(1+(1i*0.66));
k=real(0.97+0.6402i);
poftheta=sqrt((k.^2)-(cos(theta).^2));
y=(rho*sin(theta))./(poftheta);
roftheta=((y-1)./(y+1));
% ^---- missed dot
r0=-20*log10(abs(roftheta));
% ^----- here
grid on
plot(theta,r0)
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements 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!