I am trying to solve the given problem using ode45.
x'' + a x' + 7.9( x^3) = 3.2 sin(xt), and x(0) = 1.2, x'(0) = −3.3, and x(2.3) = −0.6
In this i have to find possible values of a for which x(2.3)=-0.6
Now i am trying to get a symbolic expression in a for which x(2.3) = f(a)
from this i will get an expression for a which can be solved to get possible possible values of a for which f(a) = -0.6.
Now i have written a matlab code to get this expression but matlab returns an error 'Inputs must be floats, namely single or double'
i am not sure whether ode45 can be used to get an expression for x(t) containg an unknown a. Please suggest the changes in the code below
this is the first .m file:
pdot=sym(zeros(size(q)));
pdot(2)=3.2*sin(q(1)*t)-a*q(2)-7.9*((q(1))^3);
second .m file
opts = odeset('RelTol',1e-12,'AbsTol',1e-12);
[t,x]=ode45('func4',tspan,x0,opts);
after running the second .m file i get this error
Error using odearguments (line 113)
Inputs must be floats, namely single or double.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in odeforty_five (line 4)
[t,x]=ode45('func4',tspan,x0,opts);
0 Comments
Sign in to comment.