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.

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

采纳的回答

madhan ravi
madhan ravi 2018-12-24
编辑:madhan ravi 2018-12-24
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by