I want to store the values obtained in a for loop and plot the values.Everytime I tried to plot only the last value obtained is plotted,how to plot the values obtained store in SIR

for n=1:1:2 for i=1:1:2 ds_n=abs(z(i,1)-des_user_position1); ds_ratio=ds_ratio+(ds_n/des_user_r)^n_path; end SIR= 10*log10(ds_ratio);
end

回答 (2 件)

Amit
Amit 2014 年 1 月 19 日
編集済み: Amit 2014 年 1 月 19 日
The reason why it is not plotting anything because SIR had only the last loops value in your code. Try something like:
flag = 2;
SIR = zeros(flag,1);
for n=1:1:flag
for i=1:1:2
ds_n=abs(z(i,1)-des_user_position1);
ds_ratio=ds_ratio+(ds_n/des_user_r)^n_path;
end
SIR(n,1) = 10*log10(ds_ratio);
end
plot(SIR);

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2014 年 1 月 19 日

回答済み:

2014 年 1 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by