I want to plot Id, Ib and It vs. h2 for 24 iterations as a curve. but it gives a discrete plot at 24th iteration. how I can fix that ?

1 view (last 30 days)
n = 162;
phi = 43;
Hbar = 23e+006;
Gsc = 1367;
del = 23.45*sind(360*((284+n)/365));
ws = acosd(-tand(phi)*tand(del));
h1 = 12;
for h2=1:24
w = abs(15*(h1-h2));
Hon=((24*3600*Gsc/pi)*(1+(0.033*cosd(360*n/365)))*((cosd(phi)*cosd(del)*sind(w))+(pi*ws*sind(phi)*sind(del)/180)));
kt = Hbar/Hon;
for i=1:1
if(ws<=81.4)
if (kt <0.715)
ratio = 1-(0.2727*kt)+(2.4495*kt^2)-(11.9514*kt^3)+(9.3879*kt^4);
else(kt>=0.715)
ratio=0.413;
end
else
if (kt <0.722)
ratio = 1+(0.2832*kt) - (2.5557*kt^2)+(0.8448*kt^3);
else
ratio = 0.175;
end
end
end
Hdbar = ratio*Hbar;
rd = abs((pi*(cosd(w)-cosd(ws)))/(24*(sind(ws)-((pi*ws*cosd(ws))/180))));
Id= rd*Hdbar;
a= 0.409+(0.5016*sind(ws-60));
b= 0.6609-(0.4767*sind(ws-60));
rt=rd*(a+b*cosd(w));
It=rt*Hbar;
Ib=It-Id;
plot (h2,Id,'b*',h2,It,'ro',h2,Ib,'gs')
end

Answers (1)

Walter Roberson
Walter Roberson on 3 Nov 2015
In your code, in all the places in the for loop that you assign to ratio, instead assign to ratio(i)

Categories

Find more on Polar Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!