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 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