- #1

patric44

- 272

- 37

- TL;DR Summary
- how can i transform a long symbolic expression to use in Matlab ode45?

hi guys

i build a little function that outputs a symbolic expression like that below, this is only a part of it:

the problem is the only way to integrate this output is to expand the function externally in the command window of Matlab and then

copy and paste it to the function that contains the ode45 integrator, i also tried to use vpa like this

[q,c] = myfunction(x,...)

Q= vpa(q)

C= vpa(c)

why i had to copy and paste the expression from the command window first!, is there's a way to internally expand this and make it usable in the ode45?

i build a little function that outputs a symbolic expression like that below, this is only a part of it:

the symbolic expression:

` (105*(x(5)^2/r^2 - 1)^2)/8 + (210*x(5)^2*(x(5)^2/r^2 - 1))/r^2))/(r^2)^(9/2) + (8*R^7*u*x(5)`

copy and paste it to the function that contains the ode45 integrator, i also tried to use vpa like this

[q,c] = myfunction(x,...)

Q= vpa(q)

C= vpa(c)

why i had to copy and paste the expression from the command window first!, is there's a way to internally expand this and make it usable in the ode45?