symbolic ODE with time dependent parameters
Show older comments
Hello,
I have ODE that i got from symbolic calculation:
At the begining i have symbolic matrix and vector (M and f), I multiply them and get a single symbolic vector.
SymbolicFunction =(M^-1)*f;
And "f" is build in the following way:
for i=1:n
temp=sym(0);
for j=1:n
temp=temp+CalcAij(i,j,n)*Omega(j)*Omega(j)*sin(Phi(i)-Phi(j));
end
temp=-temp-CalcBi(i,n)*(1/l)*(ydd*cos(Phi(i))-xdd*sin(Phi(i)));
f(i+n,1)=temp;
end
for samplicity we can even say that "f" is:
f=[xdd*cos(Phi(i)) ; ydd*sin(Phi(i))]
Next I use "odeFunction" function i convert it to function handle (Vars is pre-defined):
odefun = odeFunction(SymbolicFunction,Vars);
Two of the symbolic vector paramaters (xdd and ydd) is known and time-dependent. lets say: xdd=ydd=cos(t).
How can I enter time-dependent in this case?
Most of the time we can write the ODE functions and enter the paramter there.
But in my case I must work in symbolic way due to some other considerations.
I tried to create function xdd:
function R = xdd(t)
R=cos(t);
end
and to build f in the following way, but I got errors.
f=[@xdd*cos(Phi(i)) ; @ydd*sin(Phi(i))];
How can I enter time-dependent parameters when i build my ODE function from symbolic expressions using matlab function so i cant edit the function itself?
Thanks for every help,
Amit Prigozin
Answers (0)
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!