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 comentario

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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

Eka
el 26 de Jun. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by