Rank deficient warning when trying to linearize Simulink model

13 views (last 30 days)
Hi. I have been doing a Matlab School assignment and while trying to linearize the system I got the rank deficient error. The linearization also doesnt work and only returns 0. More specificaly, the error accurs when using trim function:
Du = 0.05;
[x, u, y, dx] = trim('Simulink', [], [Du], [], [], [1], [] );
[A, B, C, D] = linmod('Simulink', x, u);
G_2 = tf(ss(A, B, C, D))
Specificaly, I get this output:
Warning: Rank deficient, rank = 1, tol = 1.110223e-15.
> In qpsub
In nlconst
In simcnstr
In trim
In trim
Warning: Rank deficient, rank = 2, tol = 1.110223e-15.
> In qpsub
In nlconst
In simcnstr
In trim
In trim
Warning: Rank deficient, rank = 2, tol = 1.110223e-15.
> In qpsub
In nlconst
In simcnstr
In trim
In trim
G_2 =
0
The system itself is made of 3 reservoirs one under another and on the botom is my simulnik file. I even tried connecting the in and out to a Transfer fcn directly and running the same code, but I get the same error. I checked and I dont use any variables anywhere else.

Answers (1)

Kartik
Kartik on 15 May 2023
Hi,
It appears that you are experiencing a rank deficient error when using the "trim" function in Matlab. This error typically occurs when the specified constraints and the system inputs and outputs (i.e., the nx, ny, and nu arguments in the "trim" function) are not correctly defined.
To solve this issue, you may need to adjust the input and output constraints, as well as the input values that are being passed to the "trim" function. Here are some things to check:
  1. Check the dimensions of the input and output arguments: Make sure that the dimensions of nx, ny, and nu match the actual number of states, outputs, and inputs in your system. If these dimensions are incorrect, it may cause a rank deficient error.
  2. Check the initial values of the states and inputs: The "trim" function requires an initial guess for the system's states and inputs. Make sure that these initial values are reasonable and close to the expected steady-state values.
  3. Check the constraints you are imposing: The constraints you specify must be consistent and not overly restrictive. Make sure that the constraints are not causing the system to become over-constrained or under-constrained.
  4. Check your model: Make sure that the model you are working with is well-defined and valid. If there are any issues with the model, it can lead to a rank deficient error.
As for your specific case, it is likely that the problem lies in a mismatch between the inputs and outputs of the system and the constraints you have specified. Try adjusting the initial conditions and constraints and double-checking your model to see if this resolves the issue.
If you continue to have trouble, please provide more information about your system and the specific constraints you are using so that I can assist you further.

Categories

Find more on Modeling in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!