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);
Best Answer