MATLAB: Converting Anonymous Function to a Symbolic Function

anonymous functionsymbolic function

Hello,
I have an anonymous function that looks like this (v=velocity, t=time):
v = @(t) exp(1).^(sin(t)) – 1;
and I want to turn it into a symbolic function. How can I achieve this?

Best Answer

Is this what you're looking for?
v = @(t) exp(1).^(sin(t)) - 1;
sym(v)
%ans =
%(3060513257434037/1125899906842624)^sin(t) - 1
% where 3060513257434037/1125899906842624 is an approximation of exp(1)