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 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
madhan ravi
il 24 Dic 2018
Modificato: madhan ravi
il 24 Dic 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!