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:
determine row for ode45 data

Subject: determine row for ode45 data

From: Azrul

Date: 14 Apr, 2010 14:00:05

Message: 1 of 2

hi,
probably a stupid question but i can't seem to find the solution

suppose if i have
--------------------------------------------------------------------------------------------------------
function dydt = dydt2DOF(Time,Y)

xddot1=(-c*(Y(2)-Y(4))-k*(Y(1)-Y(3)))/m;
xddot2=(-c*(Y(4)-Y(2))-k*(Y(3)-Y(1))+kt*(road-Y(3)))/mw;

dydt = [Y(2);xddot1;Y(4);xddot2];
--------------------------------------------------------------------------------------------------------
and the main program

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

my question is how many samples it compute ? ie the size of the data .. basically it has 2 columns (time hist and state hist) but i'm not sure how many rows there are as i need to use the number of rows to do some calculation. Is there any command to determine the size ?

Thanks a lot

Subject: determine row for ode45 data

From: Steven Lord

Date: 14 Apr, 2010 14:26:00

Message: 2 of 2


"Azrul " <azrul.afifi@gmail.com> wrote in message
news:hq4hp5$5ec$1@fred.mathworks.com...
> hi,
> probably a stupid question but i can't seem to find the solution
>
> suppose if i have
> --------------------------------------------------------------------------------------------------------
> function dydt = dydt2DOF(Time,Y)
>
> xddot1=(-c*(Y(2)-Y(4))-k*(Y(1)-Y(3)))/m;
> xddot2=(-c*(Y(4)-Y(2))-k*(Y(3)-Y(1))+kt*(road-Y(3)))/mw;
>
> dydt = [Y(2);xddot1;Y(4);xddot2];
> --------------------------------------------------------------------------------------------------------
> and the main program
>
> [time_hist1, state_hist1] = ode45(@dydt2DOF,Time,Y0);
> ---------------------------------------------------------------------------------------------------------
>
> my question is how many samples it compute ? ie the size of the data ..
> basically it has 2 columns (time hist and state hist) but i'm not sure how
> many rows there are as i need to use the number of rows to do some
> calculation. Is there any command to determine the size ?

I don't know ... is there some way to compute the SIZE of a matrix in
MATLAB?


If you're looking to determine the number of rows in time_hist1, use
size(time_hist1, 1).

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

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