how to start graph in matlab from the origin?

28 visualizaciones (últimos 30 días)
hi all:
i want to start my graph from origin not from other point if you see ploting graph is started from another point and at the end we can ntot see graph so i want to start graph from origin .
thanks

Respuesta aceptada

Image Analyst
Image Analyst el 26 de Oct. de 2020
You're doing something like calling xticks() or xticklabels() with only two values. Please show us all the code involved in creating your graph. You need to be doing something like
xticks([0, max(x)]);
instead of whatever you're doing.
  1 comentario
Engineer Batoor khan mummand
Engineer Batoor khan mummand el 27 de Oct. de 2020
tahnks from all of you:
1: if we see in graph it start from between 7 and 8 AM , i want to strat this from 7 AM .
2: if we look at graph wecan not see graph end because it is hide so i want to see the last end of graph and it should some on 6pm .
3: i want to put name one above of each graph i mean Tw should come on Tw graph and T2 should come on T2 graph and so on .
thanks you so much dear
Dear Image Analyst this is my code:
I=[116 207 414 611 909 1009 951 909 805 615 311 120];
Ta=[29.164 30.256 31.186 32.237 33.127 34.137 35.148 37.129 36.119 35.148 34.137 33.127];
% X=[1:1:12]
alphag=0.05;
kg1=116.6666;
alpha1=0.08;
sigmag=0.91;
k1c=699.01;
hga=7.44;
kc2=699.01;
alphac=0.8;
sigma1=0.9;
sigma2=0.9;
alpha2=0.08;
Bc=0.8;
sigmac=0.09;
alphab=0.4;
Tw1=20;
Cw=4180;
Mw=0.05;
xo=0;
x1=1.5;
b=1;
no=0.12;
Bo=0.0045;
k2b=698.3;
kbw=30.08185759
A=1.5;
density=998;
syms p
T = zeros(7,numel(I));
for i = 1:numel(I)
M=[kg1+hga,-kg1,0,0,0,0,0;-kg1,(k1c+kg1),0,-k1c,0,0,0;0,-k1c,-kc2,(k1c+kc2),0,0,alphac*sigma1*sigmag*I(i);0,0,(Bc*kc2+k2b),-Bc*kc2,-k2b,0,0;0,0,0,Bo*no,0,0,1;0,0,-k2b,0,(k2b+kbw),0,0;0,0,0,0,-kbw*(x1-xo)*b,Cw*Mw,0;]
V=[alphag*I(i)+hga*Ta(i);alpha1*sigmag*I(i);alphac*sigma1*sigmag*I(i);Bc*alpha2*sigmac*sigma1*sigmag*I(i)+(1-Bc)*alpha2*sigma1*sigmag*I(i);no+Bo*no*Ta(i);Bc*alphab*sigma2*sigmac*sigma1*sigmag*I(i)+(1-Bc)*alphab*sigma2*sigma1*sigmag*I(i)+kbw*Tw1;-kbw*Tw1*b*(x1-xo)+Cw*Mw*Tw1]
T(:,i) = M\V;
end
T2 = T(2,:);
Tb = T(2,:);
Tc = T(3,:);
T1 = T(4,:);
Tg = T(5,:);
Tw2 = T(6,:);
N=T(7,:);
figure
plot(Tw2)
hold on
plot(Tc)
hold on
plot(Tb)
hold on
plot(T1)
hold on
plot(T2)
hold on
plot(Tg)
ylabel('T2 in PVT','fontsize',15)
xlabel('Time(hrs)');
yyaxis right
ylabel('solar radiation(w/m^2)','fontsize',15)
legend('Tw2','Tc','Tb','T1','T2','Tg')
title('Temperature varaition in system')
set(gca,'XTickLabel',{'07:00AM','08:00AM','9:00AM','10:00AM','11:00AM','12:00pm','01:00pm','02:00pm','03:00pm','04:00pm','05:00pm','06:00pm'})

Iniciar sesión para comentar.

Más respuestas (1)

drummer
drummer el 26 de Oct. de 2020
xlim[yourInitialRange, yourEndRange]
% Specifically
xlim[0, 100]; % check if it works.
% Cheers
  1 comentario
drummer
drummer el 26 de Oct. de 2020
Actually, I noticed the right side in your graph.
You want your graphic to start at 0 from the left, or in the middle and goes negative to the left and positive to the right?

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by