Printing syms / matlabFunction slow

Hi all,
I am having a lot of trouble trying to make my symbolic code go faster.
I am creating a complicated function f, and calculating its jacobian df. This goes at a reasonable pace, and I can save it to a file just fine. But when I try to use matlabFunction or even disp or fprintf, the system hangs and is unable to proceed further (even when matlabFunction is set to unoptimized). This is a major problem as I need to be able to do reasonably fast substitution.
The f vector is 24 elements, and the Jacobian is 24 x 78 (there are only 70 variables that show up here though, so this could be compressed down to 70 columns; I doubt this is the issue though).
I also know that certain elements which are simple work fine, but certain, more complicated elements of f and df cannot be displayed. I imagine they are very long, but since they are calculated just fine, it doesn't make sense to me that they cannot be transformed into a matlabFunction or displayed.
Even more bizarrely, I can substitute in for all my symbolic variables, but then the final display of the fully substituted f vector, or the conversion to double seems to take forever.
I'm attaching the file. What can I do to write out this file in a reasonable amount of time?
Thank you for your time.

3 Comments

I don't see any attached file.
Sorry, I forgot to hit the attach button (first time asking on this forum). It's attached now!
I'm facing the same issue with matlabFunction. Did you ever get this resolved?

Sign in to comment.

Answers (0)

Products

Asked:

on 15 Oct 2015

Commented:

on 3 May 2018

Community Treasure Hunt

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

Start Hunting!