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.

1 Kommentar

Walter Roberson
Walter Roberson am 26 Jun. 2012
Which variable do you consider your "input" for this purpose?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

Eka
am 26 Jun. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by