Plotting sun path diagram problem

40 ビュー (過去 30 日間)
ibrahim alzoubi
ibrahim alzoubi 2021 年 8 月 8 日
コメント済み: KSSV 2021 年 8 月 8 日
I've this code for sun path, when I run it it gives me: Matrix dimensions must agree.
How can I solve it?
clc
clear all
number_of_the_yearly_day = 1:1:365;
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);
X=asind(sin(declination).*sin(latitude)+cos(latitude).*cos(declination).*cos(w));
Y=acosd(sin(altitude).*sin(latitude)-sin(declination)./(cos(altitude).*cos(latitude)));
plot (X,Y)
ylim([-90 90]);
xlabel('Solar Azimuth (deg)');
ylabel('Solar Elevation (deg)');
title('Solar Azimuth and Elevation Angle');

回答 (1 件)

KSSV
KSSV 2021 年 8 月 8 日
clc; clear all;
clc
clear all
number_of_the_yearly_day = 1:1:365;
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);
[declination,w] = meshgrid(declination,w) ;
X=asind(sin(declination).*sin(latitude)+cos(latitude).*cos(declination).*cos(w));
Y=acosd(sin(altitude).*sin(latitude)-sin(declination)./(cos(altitude).*cos(latitude)));
plot (X,Y)
ylim([-90 90]);
xlabel('Solar Azimuth (deg)');
ylabel('Solar Elevation (deg)');
title('Solar Azimuth and Elevation Angle');
  2 件のコメント
ibrahim alzoubi
ibrahim alzoubi 2021 年 8 月 8 日
how can I make cos(w), the materix [declination,w] ?
KSSV
KSSV 2021 年 8 月 8 日
See for meshgrid.

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

カテゴリ

Help Center および File ExchangeGeodesy and Mapping についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by