Hi, I'm running the following code:
h=11:-1:-12for i = 1:length(h) beta=asind(cosd(Lat)*cosd(delta)*cosd(15*h)+sind(Lat)*sind(delta))phi_s=asind((cosd(delta)*sind(15*h))/cosd(beta));theta=acosd(cosd(beta)*cos(phi_s-phi_c)*sind(tilt)+sind(beta)*cosd(tilt));I_bc=DNI*cosd(theta)I_rc=GHI*reflectance*((1-cosd(tilt))/2);I_dc=DHI*((1+cosd(tilt))/2);I_c(i)=I_bc+I_dc+I_rcendfigure(1)plot(I_c)hold on
Basically, I want h to decrement by 1 each time. I want the loop to calculate beta, phi_s, theta and calculate I_bc. I want this value of I_bc added to I_rc and I_dc, plot that sum, and repeat the loop.
What am I doing wrong? I realize I'm supposed to index each loop somehow, but I'm not quite sure how to do so…Can you help me?
Thanks
Best Answer