Date: Apr 30, 2013 10:41 AM
Author: Torsten
Subject: Re: How to get second derivatives using ode45

"stanley ontario" wrote in message <klok4d$fjp$>...
> > vib_equ returns the first and second derivative of Y(:,1) in dy(1) and dy(2) as well as the first and second derivative of Y(:,3) in dy(3) and dy(4). So what's the problem ?
> >
> > Best wishes
> > Torsten.
> >

> Thank you for your answer.
> My problem is that I would like to call vib_equ outside the ode45, but if I do so, I have an error implying that there are undefined variables.
> For example if I want to plot both acceleration I need the values of dy(2) and dy(4), but I don't know how to call them.

For i=1:numel(t_vec)
Y_acc(i,1) = dy(2);
Y_acc(i,2) = dy(4);

does not work ?

(Of course you will have to supply the correct values for the variables in your calling list to vib_equ)

Or use the OutputFcn facility during the computation with ode45.

Best wishes