So, I have this ODE system (named Y):
Y=
2.09e-4*thetaxpp*cos(4.0*sin(3.0*t)) - 9.16e-4*thetaypp*sin(4.0*sin(3.0*t)) - 0.00125*thetayp*cos(3.0*t)*cos(4.0*sin(3.0*t)) - 0.00125*thetaxp*cos(3.0*t)*sin(4.0*sin(3.0*t))
2.09e-4*thetaypp*cos(4.0*sin(3.0*t)) + 9.16e-4*thetaxpp*sin(4.0*sin(3.0*t)) + 0.00125*thetaxp*cos(3.0*t)*cos(4.0*sin(3.0*t)) - 0.00125*thetayp*cos(3.0*t)*sin(4.0*sin(3.0*t))
3.54e-4*cos(4.0*sin(3.0*t))*sin(4.0*sin(3.0*t))*thetaxp^2 + 3.54e-4*cos(4.0*sin(3.0*t))*sin(4.0*sin(3.0*t))*thetayp^2 + 2.09e-4*thetazpp - 1.11*sin(3.0*t)
Now, I want to use the ode45i function on it, which means that I want to do:
f2=@(t,y,yp)(Y,[0 10],y0,yp0)
To do so, I need to perform these substitutions (substitute a symbolic variable with an element of a matrix) before implementing Y in the function ode15i:
thetaxpp=yp(1)
thetaypp=yp(2)
thetazpp=yp(3)
thetaxp=y(1)
thetayp=y(2)
thetazp=y(3)
(my calculations are mostly inspired by this) Now, I've tried to do:
f2=@(t,y,yp)(subs(Y,[thetaxpp, thetaypp, thetazpp, thetaxp, thetayp, thetazp],[yp(1), yp(2) , yp(3), y(1), y(2), y(3)]))
but I get the message
Error using odearguments (line 101)
Inputs must be floats, namely single or double.
I also tried isolating the equations of Y using fprintf (to transform the equations into text before doing the substitution and to transform them again into equations after) like this:
formatSpec = '\n %4.2f \n %4.3f \n %4.4f\n';
fprintf(formatSpec,Y(1),Y(2),Y(3))
but I got the message:
Error using fprintf
Function is not defined for 'sym' inputs.
Do you guys have any idea what I could do to solve my problem?
Thanks a bunch
0 Comments
Sign in to comment.