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

1 visualización (últimos 30 días)
AMAL KRISHNA.S
AMAL KRISHNA.S el 8 de Abr. de 2021
Respondida: Jan el 8 de Abr. de 2021
%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 comentario
Jan
Jan el 8 de Abr. de 2021
The expression "as soon as possible" is not appropriate in a forum, which is supported by voluntary Matlab users.

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 8 de Abr. de 2021
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;

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by