Help on using ode45

3 Ansichten (letzte 30 Tage)
maritrad
maritrad am 20 Mär. 2017
Kommentiert: maritrad am 20 Mär. 2017
Hello! I am trying to solve a system of differential equations using ode45 and I only get as a result NaN numbers. I am quite new on Matlab, can somebody help me? :)
My code is:
A = 0.3;
f = @(t,x) [x(2)*x(3)*sin(x(6)-x(5)-x(4)-A*t);...
x(1)*x(3)*sin(x(6)-x(5)-x(4)-A*t); ...
-2*x(2)*x(1)*sin(x(6)-x(5)-x(4)-A*t); ...
-x(1)^-1*x(2)*x(3)*cos(x(6)-x(5)-x(4)-A*t); ...
-x(2)^-1*x(1)*x(3)*cos(x(6)-x(5)-x(4)-A*t); ...
-2*x(3)^-1*x(2)*x(1)*cos(x(6)-x(5)-x(4)-A*t)]
[t,xa] = ode45(f,[0.01 1],[sqrt(20) sqrt(0.1*20) 0 0 0 0]);
Thanks!

Akzeptierte Antwort

Torsten
Torsten am 20 Mär. 2017
You divide by x(3) - so it's not allowed to be zero at the beginning.
Best wishes
Torsten.
  1 Kommentar
maritrad
maritrad am 20 Mär. 2017
Its true! Thank you so much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by