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 件のコメント

Walter Roberson
Walter Roberson 2012 年 6 月 26 日
Which variable do you consider your "input" for this purpose?

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-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