how to call a matrix(1*43) from model to function ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
%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 Kommentar
Jan
am 8 Apr. 2021
The expression "as soon as possible" is not appropriate in a forum, which is supported by voluntary Matlab users.
Antworten (1)
Jan
am 8 Apr. 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;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!