Solving Coupled First Order ODE dependent on Derivatives

I'm trying to use ODE45 to solve a similar differential equation to the following. I'm not sure how to write the function though.
My functions are on the left and on the write is what I would have in the matlab function file, but how do I reference y' and x'? If I try using bprime(1) and bprime(2) I get an error because I'm using them before defining them.
My file would look something like this:
function bprime = dynamicEqs(t,b)
bprime = [3*___ + b(1); ___ -2*b(2)];
end
Thanks so much

 채택된 답변

Torsten
Torsten 2015년 6월 22일
Write your equations as
[1 -3; -1 1]*[x' y'] = [x -2*y]
and use the mass matrix option of ODE45.
Best wishes
Torsten.

추가 답변 (2개)

Jan
Jan 2015년 6월 22일
Or aftzer multiplying by inv([1 -3; -1 1]):
dx = -0.5*x + 3*y;
dy = -0.5*x + y;

카테고리

질문:

2015년 6월 21일

답변:

2015년 6월 22일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by