mismatch between mux input and the vector length when using Matlab Interpreted function with persistent variables
1 view (last 30 days)
Show older comments
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1000390/image.jpeg)
When I run the simulation, the error message comes out :![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1000395/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1000395/image.jpeg)
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.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1000400/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1000400/image.jpeg)
This is how I call the input u from the intepreted function
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1000405/image.jpeg)
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.
0 Comments
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!