How to pass vectors in simulink?

I have created the dynamic model of a Stewart Platform in simulink. Since it is a non linear time varying system,i require the values of my states for computing the matrices to be multiplied by the state derivatives or states. How do i pass these values to the matlab functions which i have created(these functions compute the matrices)? I simulated my system assuming constant initial values for my states and i am getting the new states.But when i try to pass these new states back to compute the new matrices,i am getting errors.

5 Comments

Hi Sreeranj, i can't figure out what is the problem, signals on simulink can obviously be multidimensional depending on the output of the block. Maybe show signal dimension can be helpful: in Simulink display-->signals&ports-->signal dimensions
Thank you for your response . But, I am getting multidimensional output when i give some initial values to the states.The problem arises when i try to pass the new state values back to my MATLAB function block(Entire thing is a loop.I give initial states,i get new states and i use the values to get the next set of new states).Errors like "Index expressions out of bound", " Simulink does not have enough information to determine output sizes for this block." etc. pops up.
I am not having any problem when i provide the state vector initially and i am getting the new states accordingly(checked using "Display" block).But when i try to use this new state,errors pop up. Another thing is that,when i pass these new states to a copy of my matlab function block that computes the required matrices and vectors,i am getting new values. When i try to do it in a loop errors occur.
Can you share your model as a mdl file?
I have attached the model. Do let me know whether it is possible to model a non linear system like this.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!