hi i am trying to execute for loop and i am having problem as i have not proficiency in Matlab. In following program when I execute for different values of cfo, i got the value of Fp and simply i can plot the graph by intoducing two new arrays of cfo and Fp. But when i use for loop to plot the graph i get nothing. Kindly tell me what is the problem in this.
h=10;
zo=30;
v=0.4;
vo=1;
for cfo=50e3:25e3:200e3;
ip1 = lognrnd(log(33.3e3),0.605,1,1.2e5);
ip = ip1./1e3;
ymax = 0.5;
y1 = 2;
vmax = zo*ip.*y1*h*(1+((v/vo)*(1/sqrt(2))*1/sqrt(1-(0.5*(v/vo)^2))))
A=find(vmax>1.5*cfo);
n = numel(A)
Fp = 200*(n/120000)*ymax
end
plot (cfo,Fp)
set(gca, 'YScale', 'log')
grid on
hold on

 採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 5 月 29 日
編集済み: KALYAN ACHARJYA 2019 年 5 月 29 日

1 投票

I didnot check the code, wheather the correct logic or not. Just show you how you can generate then graph, do array. Keep all constant at the initial part of the code (outside for loop). Now you can modify as per your desired result.
h=10;
zo=30;
v=0.4;
vo=1;
cfo=50e3:5e3:200e3;
for i=1:1:length(cfo)
ip1=lognrnd(log(33.3e3),0.605,1,1.2e5);
ip=ip1./1e3;
ymax=0.5;
y1=2;
vmax=zo*ip.*y1*h*(1+((v/vo)*(1/sqrt(2))*1/sqrt(1-(0.5*(v/vo)^2))));
A=find(vmax>1.5*cfo(i));
n=numel(A);
Fp(i)=200*(n/120000)*ymax;
end
plot (cfo,Fp)
set(gca, 'YScale', 'log')
grid on
Hope it Helps!

その他の回答 (1 件)

Arslan Mahmood
Arslan Mahmood 2019 年 5 月 30 日

0 投票

Thanks a lot.

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

製品

リリース

R2017a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by