Values Stops Somewhere that it shouldn't

1 回表示 (過去 30 日間)
Atahan Celebi
Atahan Celebi 2018 年 11 月 14 日
再開済み: Walter Roberson 2018 年 12 月 29 日
I have 365 (days) input for my graphic but in somewhere it is stop making graphics
It is my graphic result
abc.png
Here, original graphic that I should get :
abc2.png
My whole code:
days = 1:365;
%Formulas of the Equation of Time
earth_tilt = -7.655*sin(2*pi*days/365)
elliptical_orbit = 9.873*sin(4*pi*days/365+3.588)
time_variation = earth_tilt + elliptical_orbit
plot(days,earth_tilt,'g--')
hold on
plot(days,elliptical_orbit,'r-.')
plot(days,time_variation,'black')
ax = gca;
ax.XAxisLocation = 'origin';
ax.XAxis.TickLabels = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'}';
ax.XAxis.Limits = [0 500];
title('Time Variation')
xlabel('Day of The Year','FontWeight','bold')
ylabel('Minutes','FontWeight','bold')
legend({'Earth Elliptic Orbit','Tilt of Earth Axis','Orbit+Tilt'},'FontSize',14)
% Location information of legend
set(legend, 'Location', 'NorthWest')

採用された回答

possibility
possibility 2018 年 11 月 14 日
編集済み: possibility 2018 年 11 月 14 日
Hi Atahan,
Your graph doesn't stop in the middle. The figure is the same with the original. Your months labeling is wrong. Change the axis limits from
ax.XAxis.Limits = [0 500];
to
ax.XAxis.Limits = [0 360];
I think this would resolve the problem.
Selamlar :)
--- edit -------
Although your graph is now scaled properly, your labeling for months is still wrong. In order to correct it, one way could be using text commands instead of modifying the xaxis. The code is as follows:
days = 1:365;
%Formulas of the Equation of Time
earth_tilt = -7.655*sin(2*pi*days/365);
elliptical_orbit = 9.873*sin(4*pi*days/365+3.588);
time_variation = earth_tilt + elliptical_orbit;
plot(days,earth_tilt,'g--')
hold on
plot(days,elliptical_orbit,'r-.')
plot(days,time_variation,'black')
%deleted part
%ax = gca;
%ax.XAxisLocation = 'origin';
%ax.XAxis.TickLabels = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'}';
%ax.XAxis.Limits = [0 500];
%added part
axis([0 370 -20 20]);
months={'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'};
for i=1:length(months)
text(15+(i-1)*30,-19,months(i));
end
%rest
title('Time Variation')
xlabel('Day of The Year','FontWeight','bold')
ylabel('Minutes','FontWeight','bold')
legend({'Earth Elliptic Orbit','Tilt of Earth Axis','Orbit+Tilt'},'FontSize',14)
% Location information of legend
set(legend, 'Location', 'NorthWest')
  2 件のコメント
Atahan Celebi
Atahan Celebi 2018 年 11 月 14 日
it gives error when I try
possibility
possibility 2018 年 11 月 14 日
I corrected.
Your labeling seems still wrong though. Let us work on it. I will edit my main comment.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeology についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by