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 Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

릴리스

R2017a

태그

질문:

2019년 5월 29일

답변:

2019년 5월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by