Error message: Index exceeds the number of array elements. Index must not exceed 1. When I use trim function
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
% 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);
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 Commenti
Risposte (1)
Walter Roberson
il 25 Ott 2023
3 Commenti
Walter Roberson
il 25 Ott 2023
[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);
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!