How do I plot a selective range of x-axis values
Mostrar comentarios más antiguos
I am a new user of MATLAB. Currently I have this in my script:
figure
subplot(2,2,1)
plot(t/60,mass)
grid on
title('Mass dried')
xlabel('Time, t (min)')
ylabel('Mass dried, g')
This plots time in minutes on the x-axis, where "t" is the time vector in seconds returned from the function pdepe(m,@solnpde,@solnic,@solnbc,r,t,options). The solution to the pde is from t = 0 to t = 1800.
Please advise how I can plot the graph for values of t from:
1. t = 0 to t = 600
2. t = 600 to t = 1200.
Many thanks,
Doug
Respuesta aceptada
Más respuestas (3)
Kevin Geib
el 23 de Jun. de 2022
2 votos
Hey,
another Option if you dont want to change the Plot command itself and see a specific x/y Plot is to limit your axis.
plot(t/60,mass)
grid on
title('Mass dried')
xlabel('Time, t (min)')
ylabel('Mass dried, g')
xlim([0 60])
same can be done with y-axis
ylim([0 100])
Fangjun Jiang
el 19 de Oct. de 2011
t=0:1800;
mass=t;
index=1:600;
figure(1);plot(t(index)/60,mass(index));
index=601:1201;
figure(2);plot(t(index)/60,mass(index));
Tahmid Rahman
el 23 de Abr. de 2018
x=1:0.1:100
if x<20
y1=2*sin(x);
elseif 20<=x , x<40;
y2=cos(3*x);
elseif 40<=x , x<60;
y3=sin(0.3*x);
elseif x<=60
y4=8*sin(x);
elseif y<6
y5= 6;
need to draw a graph for each y condition.
Categorías
Más información sobre Title en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!