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 ビュー (過去 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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by