How can I increase the optimization with intermediate temporary expressions during the use of the function "matlabFunction"

조회 수: 2 (최근 30일)
Hello,
I am working on a linked chain model using symbolic notation with MuPad. After I create the matrix of the model in MuPad, I reassigne it in the Matlab notebook with the function "getVar" then I create a function with "matlabFunction".
The matrix I calculate are quite big (more than 1Mo text) and something is bothering me, I find tha the optimization of the function with intermediate temporary expressions to be very light. I wish to know if there is a trick that would help me increase the number of intermediate function. Or maybe a way to rearange the matrix before exporting it with matlabFunction.
I attached a file for example.
Thank you in advance.

답변 (2개)

Walter Roberson
Walter Roberson 2015년 11월 6일
  댓글 수: 1
Mathias Blandeau
Mathias Blandeau 2015년 11월 6일
편집: Mathias Blandeau 2015년 11월 6일
Thank you for the tip !
If i combine it with generate::optimize as advised it is a bit quicker than matlab but the optimization process is still light.
Indeed, when you look at the ol and new H vector (cf attached file with new and old), you see that the equation is lighter but there could be much more intermediate function created.

댓글을 달려면 로그인하십시오.


Mathias Blandeau
Mathias Blandeau 2015년 11월 23일
Hi, I think I figured out the origin of the problem. To my suprise, the over complexity of the result was du to the function linalg::scalarProduct (??). After I wrote the scalar product manually (u.v = u1*v1 + u2*v2+...) it worked very well, especially during the generation of the function. Thanks again !

Community Treasure Hunt

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

Start Hunting!

Translated by