フィルターのクリア

how to call a matrix(1*43) from model to function ?

1 回表示 (過去 30 日間)
AMAL KRISHNA.S
AMAL KRISHNA.S 2021 年 4 月 8 日
回答済み: Jan 2021 年 4 月 8 日
%model
rep=ode45(@Obsfun,[t(1) t(end)],[x10 x20 x30 x40]);
figure(1)
plot(rep.x,rep.y(1,:))
grid
figure(2)
plot(rep.x,rep.y(2,:))
grid
%function.
y=rep.y(1,:);% inside function . it is not working. how can i get the matrix value from model to y for inserting it in the equation
% observer equation
x1_dot_hat=(((a1*x2hat*x1hat)/(a2*x1hat+x2hat))-(x1hat*u)-(2*theta*(x1hat-y)));
x2_dot_hat=(((theta^2)*(((-x2hat^2)/(a1*a2*x1hat^2))-((2*x2hat)/(a1*x1hat))-(a2/a1))+2*theta*(x2hat^2/a2*x1hat^2))*(x1hat-y)-((a3*a1*x1hat*x2hat)/(a2*x1hat+x2hat))+(a4*u)-(x2hat*u));
hope you will help as soon as possible.
  1 件のコメント
Jan
Jan 2021 年 4 月 8 日
The expression "as soon as possible" is not appropriate in a forum, which is supported by voluntary Matlab users.

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

回答 (1 件)

Jan
Jan 2021 年 4 月 8 日
You can't. rep is the final answer of the integration. Of course you cannot access it before the integration is ready.
Please explain, why you think you need the output of the integration for the integration.
It supports to understand your problem, if you post the complete code, which runs by copy&paste. Expressions like " %function." are not clear. The general information "it is not working" is less useful than a copy of the error message.
I've inserted some spaces and removed some unneded parentheses:
x1_dot_hat = (a1*x2hat*x1hat) / (a2*x1hat+x2hat) - x1hat*u - 2*theta*(x1hat-y);
x2_dot_hat = (theta^2 * ((-x2hat^2 / (a1*a2*x1hat^2)) - (2*x2hat / (a1*x1hat)) - ...
(a2/a1)) + 2*theta*(x2hat^2 / a2*x1hat^2)) * (x1hat-y) - ...
(a3*a1*x1hat*x2hat) / (a2*x1hat+x2hat) + a4*u - x2hat*u;

カテゴリ

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