Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Simple non-linear equation solving question
Replies: 7   Last Post: Feb 13, 2012 12:31 PM

Advanced Search

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

Posts: 4
Registered: 2/12/12
Re: Simple non-linear equation solving question
Posted: Feb 13, 2012 12:32 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Thanks for the response. My Matlab version is 7.10.0 (R2010a).

The full code:

clear all
clc
close all

x=[-.5:.01:1];

m=-x.^3 + (sin(x)).^2;

plot(x,m)

clear x
x = sym('x');
solve(-x.^3 + (sin(x)).^2)

Which provides a plot, and:

ans =

matrix([[0]])

From the plot, I can see that there is also a solution at about 0.803.

Thanks again...



"Nasser M. Abbasi" <nma@12000.org> wrote in message <jha64h$kls$1@speranza.aioe.org>...
> On 2/12/2012 10:42 PM, Patrick wrote:
> > Hi,
> >
> > I'm trying to solve the following non-linear equation: 0=-x^3 + (sin(x))^2
> >
> > EDU>> solve(-x^3+sin(x)^2)
> >
> > ans =
> >
> > matrix([[0]])
> >
> > By graphing this equation, it appears that there are solutions at 0 and 0.803. What am I doing wrong?
> >
> > Thanks...

>
> Which verssion do you have?
>
> on mine:
>
> MATLAB Version 7.12.0.635 (R2011a)
>
> I get
>
> --------------------
> EDU>> syms x
> solve(-x^3+sin(x)^2)
>
> ans =
>
> 0
> ----------------------
>
> matrix([[0]]) means zero solution also? i..e a vector, which one
> entry, and that entry is zero. so same answer I have.
>
> So, I do not know how you got 0.803 there. What command you used
> to plot? Please show complete code you did, not one line.
>
> --Nasser




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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.