Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Simple non-linear equation solving question
Date: Mon, 13 Feb 2012 05:32:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 70
Message-ID: <jha78q$3ph$1@newscl01ah.mathworks.com>
References: <jha4b1$os6$1@newscl01ah.mathworks.com> <jha64h$kls$1@speranza.aioe.org>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1329111130 3889 172.30.248.45 (13 Feb 2012 05:32:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Feb 2012 05:32:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1172347
Xref: news.mathworks.com comp.soft-sys.matlab:757481

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