Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to get second derivatives using ode45
Replies: 4   Last Post: Apr 30, 2013 11:15 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Torsten

Posts: 1,472
Registered: 11/8/10
Re: How to get second derivatives using ode45
Posted: Apr 30, 2013 10:41 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"stanley ontario" wrote in message <klok4d$fjp$1@newscl01ah.mathworks.com>...
>
> > 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(1)=Y(i,1);
y(2)=Y(i,2);
y(3)=Y(i,3);
y(4)=Y(i,4);
t=t_vec(i);
dy=vib_equ(t,y,c_s_f,c_s_r,v_val,F_d_val,m_c,I_g_c,l,l_f,l_r,u_f,u_f_dot,v,L,i_d);
Y_acc(i,1) = dy(2);
Y_acc(i,2) = dy(4);
end

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
Torsten.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.