what is the error in this program

4 ビュー (過去 30 日間)
sanjiv kumar
sanjiv kumar 2019 年 9 月 5 日
コメント済み: sanjiv kumar 2019 年 9 月 5 日
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

採用された回答

Stephen23
Stephen23 2019 年 9 月 5 日
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 件のコメント
sanjiv kumar
sanjiv kumar 2019 年 9 月 5 日
thank you for helping me............

サインインしてコメントする。

その他の回答 (1 件)

Alex Mcaulley
Alex Mcaulley 2019 年 9 月 5 日
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')

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by