"ZACHARY HULL" <firstname.lastname@example.org> wrote in message news:email@example.com... > Good day all, > > I am working a problem that requires me to use the 'solve' function of > matlab. > > The script below is what I solving for: > > t = linspace(0,pi,200); > ft = exp(sin(t)); > %plot(t,ft) > ft_max = max(ft); > t_max = max(t); > tf = asin(log(ft_max)); > display(['The extremum is located at (',num2str(tf),',',num2str(ft_max),') > and it is a maximum.']) > > ans = The extremum is located at (1.5629,2.7182) and it is a maximum. > > This is solving the problem without the use of the solve function. > ____________________________________________________________ > However, when I attempt to use 'solve' (required for the problem) the > equation ft below for variable t, this is my result: > > (script) > syms t > t = linspace(0,pi,200);
This assignment to t makes it numeric again. It is no longer symbolic after this line. That means:
> ft = exp(sin(t));
ft is also numeric, and this:
> tf = solve(ft,t)
attempts to solve for the solution of a vector of numbers with the independent variable also a vector of numbers.
But even if you removed the line where you assigned LINSPACE into t, it wouldn't work. Your equation has no real solution. For real finite z, exp(z) is always positive. Well, in double precision it can underflow. But you can't generate a value that would cause exp(z) to underflow when z is computed as sin(t) unless t is complex.