how can i solve this error in simulink?

2 次查看(过去 30 天)
hello.
i can't solve this error.
i attached simulink file.
( dynsys block function is system's dynamic in state space, ric_schur solve Riccati equation and fcn block function is input)

采纳的回答

Ameer Hamza
Ameer Hamza 2020-4-30
In the block 'fcn', correct these lines
R=[1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 1];
%^ this space is missing in your file
u =-inv(R)*B*P*x1;
%^ do not take transpose of P, it is already column vector
Also in this function
function [ddy,ddq] = dynsys(y,ydot,q,qdot,u)
% 4 states (x):
%% parameters
Phils=-0.1104;M=1.1637;K=2.9327;alpha=0.183;
Gamma=0.4537;D=0.6;ws=9.896;F=0.42;G=0.028;
clo=0.28;Lambda=0.0676;
%% Obtain x, u and y
% x
y=x(1);
ydot=x(2);
q=x(3);
qdot=x(4);
%% y
ddy=(1/M)*(-(2*alpha)/(D*ws)*Gamma*x(2)-K*x(1)+Gamma*x(3)+Phils*u);
ddq=ws*G*clo^2*x(4)-ws^2*x(3)-Lambda*x(3)^2*x(4)+((ws*F)/(D))*x(2);
Input variable is 'y', but you are using x(1), x(2) in your code. Correct variable names according to your equations.
If you resolve this issue, hopefully all the errors will get resolved.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by