Index in position 1 is invalid. Array indices must be positive integers or logical values problem
1 次查看(过去 30 天)
显示 更早的评论
It gives me "Index in position 1 is invalid. Array indices must be positive integers or logical values."
How can I solve it
clc
clear all
number_of_the_yearly_day = 1:1:365; %n
T=1:1:24;
declination=23.45.*sin((2.*pi.*(number_of_the_yearly_day-80))./(365));%?
latitude=31.963158; %?
Zenith_angle=latitude-declination; %??
tilt_angle=Zenith_angle;%?
altitude=1-Zenith_angle; %?
w=15.*(12-T);
for i=1:365
w(i,:)=w(i-1,:)+1
end
Y=acosd(sin(altitude).*sin(latitude)-sin(declination)./(cos(altitude).*cos(latitude)));
X=asind(sin(declination).*sin(latitude)+cos(latitude).*cos(declination).*cos(w));
plot (X,Y)
0 个评论
回答(1 个)
Asaad Abboud Alkhalaf
2021-8-3
i-1 = 0 and this can not be array indices it has to be 1 , 2, 3, .......
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!