can anyone help me for loop

3 ビュー (過去 30 日間)
Jose Louis
Jose Louis 2016 年 7 月 15 日
編集済み: Walter Roberson 2016 年 7 月 15 日
I have question for example w=15*(ts-12), w start from some value not from 1 to some value and the number of values 360 , how can make a loop start from the first value of w to last value
for w=15*(ts-12)
H(w)=sind(w+1)-sind(w)
end

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 15 日
編集済み: Azzi Abdelmalek 2016 年 7 月 15 日
w=linspace(some_value1,some_value2,360)
H=sind(w+1)-sind(w)
  2 件のコメント
Jose Louis
Jose Louis 2016 年 7 月 15 日
編集済み: Azzi Abdelmalek 2016 年 7 月 15 日
thank you, Mr. Azzi, but the value of w not constant, anyway this my code the problem with the loop i don't know how to write the loop
n=1:1:365 ; %the day of the year [a number 1 through 365]
fi=19.9450; %is the latitude
GMT=2 ;% Time Zone for example +2
LT=5; % local time (LT).
lambda=50.067;% longitude
Zc=15*GMT;%Local Standard Time Meridian
B=(360/365)*(n-81)*pi/180;% in degrees and d is the number of days since the start of the year
E=9.87*sin(2*B)-7.53*cos(B)-1.5*sin(B); % (in minutes) is an empirical equation that corrects for the eccentricity of the Earth's orbit and the Earth's axial tilt.
tc=4*(lambda-Zc)+E;%Time Correction Factor
ts=LT+(tc/60);%Local Solar Time (LST) can be found by using the previous two corrections to adjust the local time (LT).
w=15*(ts-12);%Hour Angle converts the local solar time (w) into the number of degrees which the sun moves across the sky
segma=23.45*sin((284+n)/36.25); %The solar declination
Gsc=1.367;%solar constant [1.367 kW/m2],
Gon=Gsc*(1+0.033*cos(360*n/365));
for J=1:length(w)
H(w)=sind(w+1)-sind(w);
%B=diff(sind(1:365))
end
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 15 日
編集済み: Azzi Abdelmalek 2016 年 7 月 15 日
fi=19.9450; %is the latitude
GMT=2 ;% Time Zone for example +2
LT=5; % local time (LT).
lambda=50.067;% longitude
Zc=15*GMT;%Local Standard Time Meridian
for n=1:365 %the day of the year [a number 1 through 365]
B=(360/365)*(n-81)*pi/180;% in degrees and d is the number of days since the start of the year
E=9.87*sin(2*B)-7.53*cos(B)-1.5*sin(B); % (in minutes) is an empirical equation that corrects for the eccentricity of the Earth's orbit and the Earth's axial tilt.
tc=4*(lambda-Zc)+E;%Time Correction Factor
ts=LT+(tc/60);%Local Solar Time (LST) can be found by using the previous two corrections to adjust the local time (LT).
w(n)=15*(ts-12);%Hour Angle converts the local solar time (w) into the number of degrees which the sun moves across the sky
segma=23.45*sin((284+n)/36.25); %The solar declination
Gsc=1.367;%solar constant [1.367 kW/m2],
Gon=Gsc*(1+0.033*cos(360*n/365));
end
H=sind(w+1)-sind(w)
%B=diff(sind(1:365))

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEarth and Planetary Science についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by