Effacer les filtres
Effacer les filtres

Values Stops Somewhere that it shouldn't

2 vues (au cours des 30 derniers jours)
Atahan Celebi
Atahan Celebi le 14 Nov 2018
Rouvert : Walter Roberson le 29 Déc 2018
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')

Réponse acceptée

possibility
possibility le 14 Nov 2018
Modifié(e) : possibility le 14 Nov 2018
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 commentaires
Atahan Celebi
Atahan Celebi le 14 Nov 2018
it gives error when I try
possibility
possibility le 14 Nov 2018
I corrected.
Your labeling seems still wrong though. Let us work on it. I will edit my main comment.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by