Question regarding ode45 function and scripts
이전 댓글 표시
So I have a script saved as, "Project_1a", within it are the following lines of code:
function dy = derives(t,y)
g = 9.8;
dy = [y(2);-g];
In the command window, I have inputted the following lines:
g = 9.8;
h0 = 0;
v0 = 0;
[t,y]=ode45('Project_1a',[0:0.01:200],[h0 v0]);
Why does this work? In the sense, that I have been told that the script needs to match the function ie. the script needs to be saved as "derives". I made two scripts one called "Project_1a" and "derives" that have the same code as above and they both output the same array. Can anyone explain as to why they don't need to have the same name or if my code is just special occurrence that managed to work out?
Thanks
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!