plot nonlinear system with constant input

I want ask about how I plot nonlinear system with constant input, I have sample but using sinusoidal input,this is a sample :
Function u=finp(t)
A=1
w=2
u=A*sin(w*t)
function dx=sys2(t,x)
m=1;b=5;k=3;
%evaluate the external function %value for a given value of t
u=feval(finp,t)
%to make dh a column vector
dx = zeros(2,1);
%computing derivatives
dx(1)=x(2);
dx(2)= u -(k/m)*x(1)-(b/m)*x(2);
>>[t,x]=ode45(@sys2,[0 10],[5 0]);
for i=1:length(t),u(i)=feval(finp,t(i)); end
>> plot(t,u,t,x)
if my input just constant like 0.01,how I must running the program?thank you.

回答(0 个)

类别

帮助中心File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

提问:

Eka
2012-6-26

Community Treasure Hunt

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

Start Hunting!

Translated by