|
"Ricardo " <rhicardo.af@gmail.com> wrote in message <iuf91q$rej$1@newscl01ah.mathworks.com>...
> ok, but I didn't explaine well
> x''(t) = x'(t) + x(t) + y''(t) + y(t)
> y''(t) = x''(t) + x(t) + y'(t) + y(t)
>
> I think, I can't do that what you suggest...I suppose
- - - - - - - - - - -
You have to do some initial algebra on your two equations before submitting them to ode45. The ode solver is simply not smart enough to do this for you.
Adding the two equations and manipulating will give you this:
x'+y' = -2*(x+y)
Subtracting them and more manipulation will produce this:
x"-y" = 1/2*(x'-y')
This tells you to define new variables u = x+y and v1 = x-y, v2 = x'-y' and to make two separate calls on ode45 using your known initial values:
The first call would be:
du/dt = -2*u
and the second call is:
dv2/dt = 1/2*v2
dv1/dt = v2
From the solutions u and v, you can then derive x and y. (Of course we all know from calculus what these solutions will be without even bothering to use ode45.)
Note that your initial values for x', y', x, and y are interdependent and must satisfy x'+y'+2*x+2*x = 0. That is, these equations have only three independent parameters.
Roger Stafford
|