|
"Nasser M. Abbasi" <nma@12000.org> wrote in message <d15de460-70e9-4d4a-99a5-99a6335248ec@i10g2000prd.googlegroups.com>...
> On Nov 26, 6:23 pm, "Paulo " <paulojmdsi...@gmail.com> wrote:
> > Hi, I'm trying to make something similar tohttp://demonstrations.wolfram.com/PendulumOnAMovingSupport/, I already have a function to do the animation given the position of the cart and angle of pendulum but I just don't know how to do the solving of those differential equations in matlab, can someone please help me? thank you in advance
>
>
> did you try 'dsolve' ?
>
> "EDU>> help dsolve
> DSOLVE Symbolic solution of ordinary differential equations.
> DSOLVE('eqn1','eqn2', ...) accepts symbolic equations representing
> ordinary differential equations and initial conditions."
>
> --Nasser
Hi thanks for the reply, I tried like this:
clc;syms a;syms x;l=1;t=0:0.1:1;
eq='D2a(t)+D2x(t)/l*cos(a(t))+9.8/l*sin(a(t))=0,2*D2x(t)+l*D2a(t)*cos(a(t))-l*(Da)^2*sin(a(t))=0)';
dsolve(eq,'x(0)=0','a(0)=0','Dx(0)=0','Da(0)=0')
but it doesn't work, error:
??? Attempted to access Eqn(1); index out of bounds because numel(Eqn)=0.
Error in ==> dsolve at 240
if isequal(Eqn(1),'[') & isequal(Eqn(end),']')
Error in ==> testeDSOLVE at 3
dsolve(eq,'x(0)=0','a(0)=0','Dx(0)=0','Da(0)=0')
I don't know what to do in order to make it work, any ideas?
|