COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### 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;

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

```"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;
>
> 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

1 Replies
237 Views

Similiar Articles:

7/28/2012 9:01:07 AM