The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: solve help
Replies: 4   Last Post: Jun 24, 2013 10:59 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: solve help
Posted: Jun 24, 2013 10:59 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"ZACHARY HULL" <> wrote in message
> 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.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.