mismatch between mux input and the vector length when using Matlab Interpreted function with persistent variables

3 Ansichten (letzte 30 Tage)
Hi, I am using the interpreted function MPC3DOF(u) to compute the control force. The input u is a mux vector with 23 elements as shown in the function. Uout is the output vector of the function with 12 elements. The 3rd and 4th elements of Uout are feedback to the first and second input of u with memory block.
When I run the simulation, the error message comes out :
The number of element length appears in the simulink as well. I don't understand why the input port 3 of Mux is a vector with 2 elements.
This is how I call the input u from the intepreted function
I also tried MPC3DOF(u(1:2),u(3:8),u(9:20),u(21:22),u(23)). But same error message appears.
When I test the interpreted function alone, like input a time series with the data of 23 elements each time step, it works fine. But when I put it into the model, the error message appers.
Could anyone please offer some advice on this issue? Thank you in advance.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by