Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ode45

Subject: ode45

From: Azrul

Date: 12 Apr, 2010 12:11:04

Message: 1 of 1

hi ..
im new with matlab and having difficulties on plotting the graph.. supposed if i have :
------------------------------------------------------------------------------------------------------------------
Time = [0 10];

[time_hist1, state_hist1] = ode45(@dydt2DOF,Time,Y0);

% Plotting the vehicle body displacement
subplot(2,2,1);
plot(time_hist1, state_hist1(:,1),'-.');
ylabel('x1 [m]'); xlabel('Time[s]');


% Plotting the body acceleration
subplot(2,2,2);
acceleration005 = (c005*(state_hist1(:,4)-state_hist1(:,2))+k*
                          (state_hist1(:,3)-state_hist1(:,1)))/m;

plot(time_hist1, acceleration005,'--');
ylabel('a1 [m/s^2]'); xlabel('Time[s]');

% Plotting the suspension travel
subplot(2,2,3);
plot(time_hist1, (state_hist1(:,1)-state_hist1(:,3)),'--');hold on;
ylabel('x1-x2 [m]'); xlabel('Time[s]');

%Plotting the dynamic tyre force
subplot(2,2,4);
plot(time_hist1, kt*(state_hist1(:,3)-road),'--');hold on;
ylabel('Dynamic tyre force [N]'); xlabel('Time[s]');
-------------------------------------------------------------------------------------------------------------------
my question is how do i specify that for the 2nd,3rd and 4th graph, i only want matlab to show me the graph for T=[0 1] instead of the whole T=[0 10] . I have tried to put T=[0 1] before the 'subplot(2,2,2);' line but clearly its not the way to do it.

also, does anyone know how to type damping ratio (sigma) symbol in matlab ?

thank you :)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us