How do i resolve this problem ??????
이전 댓글 표시
this is state space model of dynamical system. in this problem, v is input of system. i'd like to put a function ( i made a function v below ) on v what should i do?
function xdot=example(t,x,v)
xdot=zeros(2,1);
xdot(1)=x(2);
xdot(2)=(v-4*x(1)-7*x(2))/5;
end
//////////////////////////////////////////////////////
tspan=0:0.01:20;
k=0;
for time=0:0.01:20;
k=k+1;
if time<1
v(k)=10*time;
elseif time<=4
v(k)=10;
elseif time<=5
v(k)=-10*(time-4)+10;
else
v(k)=0;
end
end
[t,x]=ode45(@example,tspan,[0 9],[],v);
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numeric Solvers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!