フィルターのクリア

'Matlab says that the problem is at (t), i want to use ode45

1 回表示 (過去 30 日間)
Eleftherios
Eleftherios 2022 年 12 月 7 日
回答済み: Sam Chak 2022 年 12 月 7 日
function dxdt = odefun (t,x)
dxdt = zeros(3,1);
dxdt(1)= -(8/3)*x(1)+x(2)*x(3);
dxdt(2)= -10*x(2)+10*x(3);
dxdt(3)= -x(3) -x(2)*x(1)+28*x(2);
end

回答 (2 件)

Bora Eryilmaz
Bora Eryilmaz 2022 年 12 月 7 日
編集済み: Bora Eryilmaz 2022 年 12 月 7 日
As long as you call your function the right way, it should work:
ode45(@odefun, [0 10], [1 1 1])
function dxdt = odefun (t,x)
dxdt = zeros(3,1);
dxdt(1)= -(8/3)*x(1)+x(2)*x(3);
dxdt(2)= -10*x(2)+10*x(3);
dxdt(3)= -x(3) -x(2)*x(1)+28*x(2);
end

Sam Chak
Sam Chak 2022 年 12 月 7 日
Guess you probably want to view the Lorenz attractor.
[t, x] = ode45(@odefun, [0 100], [1 1 1]);
plot3(x(:,1), x(:,2), x(:,3))
az = 90;
el = 0;
view(az, el)
function dxdt = odefun(t, x)
dxdt = zeros(3,1);
dxdt(1) = - (8/3)*x(1) + x(2)*x(3);
dxdt(2) = - 10*x(2) + 10*x(3);
dxdt(3) = - x(3) - x(2)*x(1) + 28*x(2);
end

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by