필터 지우기
필터 지우기

Same result but without ode45

조회 수: 2 (최근 30일)
Kebels3
Kebels3 2021년 3월 4일
댓글: Rik 2021년 3월 4일
Hi guys,
for a school test i need to rewrite this code, but whitout the function ode45
F = @(t, x) [x(2); -0.1/50*x(2) - 2*x(1)]
T = 0:0.001:10; S = [0.5 0];
[t, y] = ode45(F, T, S);
plot(t,y)
legend({'Position', 'Speed'});
xlabel('Time [s]');
ylabel('Position [S] // Speed [v]');
But im stuck, can you guys help me?
  댓글 수: 2
Marnix Moons
Marnix Moons 2021년 3월 4일
Dear forum user,
If the school wants you to implement this without using ode45, you should suppose they will not be happy if you use the results that other Matlab users post here.
Rik
Rik 2021년 3월 4일
You can find guidelines for posting homework on this forum here. If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks). If your main issue is with understanding the underlying concept, you may consider re-reading the material you teacher provided and ask them for further clarification.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2021년 3월 4일
ODE45 is a stepsize controlled Dormand Prince Integrator with local extrapolation.
If you want to get exactly the same results, you find the instructions here:
  • The MATLAB ODE Suite, L. F. Shampine and M. W. Reichelt, SIAM Journal on Scientific Computing, 18-1, 1997.
  • Mark W. Reichelt and Lawrence F. Shampine, 6-14-94
I have written such an Dormand Prince method by my own also as homework in the university. It is possible to do this in 2 or 3 hours. You find many published codes of others also, e.g. in the FileExchange.
If you are trying this by your own, please post your code and explain, what "I'm stuck means". Based on the given information it is not possible to suggest a solution of your porblem.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by