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 Commento

Which variable do you consider your "input" for this purpose?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange

Tag

Richiesto:

Eka
il 26 Giu 2012

Community Treasure Hunt

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

Start Hunting!

Translated by