フィルターのクリア

how can I saturate the outputs of ODE45 using event functions with odeset ?

3 ビュー (過去 30 日間)
yosra welhazi
yosra welhazi 2015 年 4 月 15 日
コメント済み: Torsten 2015 年 4 月 17 日
Dear friends; I have the differential equations given as follows:
x1'=x1*(1-x2^2)-x2
x2'=x1
I have created an m-file which contains these differential equations and I have constrained the variables x1 and x2 to their upper and lower limits (-limit and +limit)
function xdot=fun(t,x)
xdot=zeros(2,1);
xdot(1)=x(1)*(1-x(2)^2)-x(2);
xdot(2)=x(1);
end
then I have simulated the differential equation defined in the function fun over the interval 0<=t<=20;
x0=[0;0.25];
[t,x]=ode45('fun',[0:0.01:20],x0);
plot(t,x)
My problem consists in how to limit the state variable x because I have the condition
-2<=x(1)<=2
So, how can I simulate the differential equation over the interval 0<=t<=20 with satisfying this condition, I will be very grateful if someone can help me to solve this problem using event function with odeset.
Thanks

採用された回答

Torsten
Torsten 2015 年 4 月 16 日
編集済み: Jan 2015 年 4 月 16 日
Your question has already been answered under
Maybe you did not understand my answer ? Or I misunderstood your question ?
Best wishes
Torsten.
  2 件のコメント
yosra welhazi
yosra welhazi 2015 年 4 月 16 日
Dear Torsten,
You have told me that the input variables can be satureted using event functions, but I don't know how to do this ? this problem makes me desperate
Torsten
Torsten 2015 年 4 月 17 日
No, I answered that your problem cannot be solved.
The solution of your differential equation is fixed by the equation itself and the initial conditions you impose - you can not limit the solution by introducing artificial constraints.
Best wishes
Torsten.

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

その他の回答 (1 件)

Jan
Jan 2015 年 4 月 16 日
Limiting the values means a discontinuity of the function, which cannot be handled by the ODE integrators, see http://www.mathworks.com/matlabcentral/answers/59582#answer_72047 .
So use an event function to detect the time, when x(1) exceed the limits.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by