determine row for ode45 data

  • Follow


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
0
Reply Azrul 4/14/2010 2:00:05 PM

"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 


0
Reply Steven 4/14/2010 2:26:00 PM


1 Replies
237 Views

(page loaded in 0.031 seconds)

Similiar Articles:













7/28/2012 9:01:07 AM


Reply: