what is the error in this program

3 visualizaciones (últimos 30 días)
sanjiv kumar
sanjiv kumar el 5 de Sept. de 2019
Comentada: sanjiv kumar el 5 de Sept. de 2019
for k=5:5:50
z=zeros(1,length(k));
Pr1=(10*0.75*0.75*(exp(-0.984*k/cos(pi/36)))*0.01*cos(pi/36)/((2*pi*k.^2)*(1-cos(pi/3))));
%Pr_dbm1(k)=10*log10(Pr1)
z(k)=10*log10(Pr1);
plot(k,z)
xlabel('distance')
ylabel('Power')
title('Rcvd Power vs Distance')
%Pr1
end

Respuesta aceptada

Stephen23
Stephen23 el 5 de Sept. de 2019
k = 5:5:50;
Pr1 = (10*0.75*0.75*(exp(-0.984*k./cos(pi/36))) .* 0.01 .* cos(pi/36) ./ ((2*pi*k.^2)*(1-cos(pi/3))));
z=10.*log10(Pr1);
plot(k,z,'-*')
untitled.png
  1 comentario
sanjiv kumar
sanjiv kumar el 5 de Sept. de 2019
thank you for helping me............

Iniciar sesión para comentar.

Más respuestas (1)

Alex Mcaulley
Alex Mcaulley el 5 de Sept. de 2019
There is no error in your code, the problem is that it doesn't do whatt you want. I guess you want something like this (without loops):
k=5:5:50;
Pr1=(10*0.75*0.75*(exp(-0.984*k/cos(pi/36)))*0.01*cos(pi/36)./((2*pi*k.^2)*(1-cos(pi/3))));
%Pr_dbm1(k)=10*log10(Pr1)
z=10*log10(Pr1);
plot(k,z)
xlabel('distance')
ylabel('Power')
title('Rcvd Power vs Distance')

Community Treasure Hunt

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

Start Hunting!

Translated by