ode45 with multiple value for a single variable in a function file
이전 댓글 표시
function [ dudt ] = task3a_function( t,y )
w = 1
dudt = zeros(2,1)
dudt(1) = y(2)
dudt(2) = (10*sin(w*t))/3 - (75*y(1))/3
end
The value of w should be 1, 5, 10
and this is the ode45 file
tspan = [0 20]
initialvalues = [0 0]
fname ='task3a_function'
[t,y] = ode45(fname,tspan,initialvalues)
figure (1) % w = 1
plot(t,y(:,1)) % w = 1
figure (2) % w = 5
plot(t,y(:,1)) % w = 5
figure (3) % w = 10
plot(t,y(:,1)) % w = 10
Anyone can tell me how to get the 3 graph for w = 1, 5,10 respectively.
Thank you
채택된 답변
추가 답변 (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!