how can i solve this error in simulink?

2 ビュー (過去 30 日間)
zahra zamani
zahra zamani 2020 年 4 月 30 日
コメント済み: Ameer Hamza 2020 年 5 月 1 日
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.
  2 件のコメント
zahra zamani
zahra zamani 2020 年 5 月 1 日
yes , thank you so much
Ameer Hamza
Ameer Hamza 2020 年 5 月 1 日
Glad to be of help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by