Error message: Index exceeds the number of array elements. Index must not exceed 1. When I use trim function

9 次查看(过去 30 天)
% Define the trim condition
Y0 = 2500; % RPM
X0 = [2500; 0; 0; 0]; % Initial guess for the state vector
U0 = 0; % Input value for trimming
% Perform the trimming
[X0, U0] = trim(model,X0,U0,[],[],Y0);
Unrecognized function or variable 'model'.
The above is my code. Unfortunately, I can't provide the model. The Simulink Model have one input and Three output. But two of three output connects to the Terminator Block.
  3 个评论
Changyu
Changyu 2023-10-25
After I run this. C:\Program Files\MATLAB\R2023a\toolbox\simulink\core\general\trim.p
Is .p means this file is a variable?

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2023-10-25
According to trim y0 must be immediately after u0
  3 个评论
Walter Roberson
Walter Roberson 2023-10-25
[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy) finds the trim point closest to x0, u0, y0 that satisfies a specified set of state, input, and/or output conditions. The integer vectors ix, iu, and iy select the values in x0, u0, and y0 that must be satisfied.
You are passing Y0 in the iy position, and Y0 = 2500 in your code. That tells trim() that the 2500'th y0 value must be satisfied. But you only have one y0 value, which is the scalar Y0.
The iy is an index not a value .
You should probably just be using
[X0, U0] = trim(model,X0,U0,Y0);
Changyu
Changyu 2023-10-25
Warning: Rank deficient, rank = 1, tol = 1.332268e-15.
> In qpsub
In nlconst
In simcnstr
In trim
In trim
Maximum number of function evaluations exceeded;
increase OPTIONS(14)
It doesn't work. I can't understand the error message.

请先登录,再进行评论。

类别

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

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by