Problem with large symbolic matrix in matlabFunctionBlock

6 views (last 30 days)
I have a symbolic matrix with large dimension and also long elements (18 by 18 call it H) which is the mass matrix in dynamics of a robot and is comprised of many sine and cosine terms. I have to send it to simulink for further simulation. first I tried conversion to string using char(H) and then fprintf to save it in a .txt file but it is very large and its size is 28Mb which is very large for simulink and it makes Simulink stop working then I tried matlabFunctionBlock which is very slow and practically does not respond! then I tried using simplify in the matlab code which generates the matrix but it is also makes me nearly 'out of memory' despite the fact that my available memory is near 8Gb! It should be mentioned that I have a quad core CPU and use a x64 matlab2012b. so I dont know what to do and any suggestion would be appreciated.

Answers (1)

Deepak Ramaswamy
Deepak Ramaswamy on 4 Jun 2014
If you still have the issue, could you just try matlabFunction(H, your variables) and see if the anonymous function is computed quickly.
Also if H is symmetric, you could zero out the sub-diagonals, generate the code (matlabFunctionBlock) and then hand-modify it to make it symmetric again. Or you could divide and conquer even on the sup-diagonals...

Categories

Find more on Symbolic Math Toolbox 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!