odeToVectorField: Unable to convert the initial value problem to an equivalent dynamical system.

5 views (last 30 days)
Could anyone help me with following Matlab codes. Why do they generate error and how to fix them?
syms t v1(t) v2(t) v3(t)
equ=[v1(t) == 10e-03*sin(2*pi*1e08*t);...
1e-00*(v2(t)-v1(t))+1e-03*(v2(t)-v3(t))+1e-09*diff(v2(t)-v3(t),t) == 0;...
1e-03*(v3(t)-v2(t))+1e-09*diff(v3(t)-v2(t),t)+1e-03*v3(t) == 0];
Vect=odeToVectorField(equ);

Accepted Answer

Stephan
Stephan on 10 Jan 2019
Hi,
i deleted my first answer - cause your comment brought me to a new thought - DAE:
syms t v1(t) v2(t) v3(t)
eq1 = v1(t) == 10e-03*sin(2*pi*1e08*t);
eq2 = 1e-00*(v2(t)-v1(t))+1e-03*(v2(t)-v3(t))+1e-09*diff(v2(t)-v3(t),t) == 0;
eq3 = 1e-03*(v3(t)-v2(t))+1e-09*diff(v3(t)-v2(t),t)+1e-03*v3(t) == 0;
eqs = [eq1 eq2 eq3];
vars = [v1 v2 v3];
f = daeFunction(eqs,vars)
This works and gives you a function handle which can be used with ode15i:
f =
function_handle with value:
@(t,in2,in3)[in2(1,:)-sin(t.*6.283185307179586e8)./1.0e2;in3(2,:)./1.0e9-in3(3,:)./1.0e9-in2(1,:)+in2(2,:).*1.001-in2(3,:)./1.0e3;in3(2,:).*(-1.0e-9)+in3(3,:)./1.0e9-in2(2,:)./1.0e3+in2(3,:)./5.0e2]
I'm sorry that I notice so late!
Best regards
Stephan
  4 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!