Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Solving a nonlinear equation symbolically

Subject: Solving a nonlinear equation symbolically

From: Jim

Date: 26 Oct, 2003 17:58:41

Message: 1 of 7

How do you solve a nonlinear equation so that the answer is totally
symbolic? The variable that I want to solve for is of the order 6.
All the examples I see, show these types of equations being solved
for to get a specific number. I would like to simply have MATLAB
rearrange the equation to isolate the solutions of the variable I'm
looking for. I've tried several commands such as 'solve', 'fzero',
and 'roots', but I obviously am doing something wrong. Thanks.

Subject: Solving a nonlinear equation symbolically

From: Ross Woods

Date: 27 Oct, 2003 01:25:49

Message: 2 of 7

Jim wrote:
>
>
> How do you solve a nonlinear equation so that the answer is totally
> symbolic? The variable that I want to solve for is of the order 6.
>
> All the examples I see, show these types of equations being solved
> for to get a specific number. I would like to simply have MATLAB
> rearrange the equation to isolate the solutions of the variable I'm
> looking for. I've tried several commands such as 'solve', 'fzero',
> and 'roots', but I obviously am doing something wrong. Thanks.


Hi,


I suspect the tools you will need are in the symbolic toolbox. Do you
have it?


 <http://www.mathworks.com/products/symbolic/>


Cheers,
Ross

Subject: Solving a nonlinear equation symbolically

From: Jim

Date: 27 Oct, 2003 01:59:54

Message: 3 of 7

Hi Ross,


Thanks for the response. I do have the symbolic toolbox, but I guess
I need help in using it and it's commands. Any suggestions? Also,
here is the equation that I'm trying to solve (for x):


4*p*x*(x^2-1)*(1-(1/x^3))+((2*c)/r)*((x/r)-1)+((k*L)/A)*(x-1)=0


>
> Hi,
>
> I suspect the tools you will need are in the symbolic toolbox. Do
> you
> have it?
>
> <http://www.mathworks.com/products/symbolic/>
>
> Cheers,
> Ross

Subject: Solving a nonlinear equation symbolically

From: Ross Woods

Date: 27 Oct, 2003 03:01:09

Message: 4 of 7

Jim wrote:
>
>
> Hi Ross,
>
> Thanks for the response. I do have the symbolic toolbox, but I
> guess
> I need help in using it and it's commands. Any suggestions? Also,
> here is the equation that I'm trying to solve (for x):
>
> 4*p*x*(x^2-1)*(1-(1/x^3))+((2*c)/r)*((x/r)-1)+((k*L)/A)*(x-1)=0
>
>>
>> Hi,
>>
>> I suspect the tools you will need are in the symbolic toolbox.
Do
>> you
>> have it?
>>
>> <http://www.mathworks.com/products/symbolic/>
>>
>> Cheers,
>> Ross
Hi,
I don't have the symbolic math toolbox. On the mathworks page (http://www.mathworks.com/products/symbolic/demos.jsp#)
nder Symbolic Equation Solving is the sort of thing you are trying to
do.
solve looks like the right thing to use.


Did you try on a simpler example like
X = solve('a*x^2+b*x+c=0', 'x')


However, it would be an unusual 6th order polynomial that had an
exact analytical solution. There are no general solutions for the
roots of 6-th order polynomials.


Cheers,
Ross

Subject: Solving a nonlinear equation symbolically

From: nospamspellucci@fb04373.mathematik.tu-darmstadt.de (Peter Spellucci)

Date: 28 Oct, 2003 17:43:04

Message: 5 of 7


In article <eec61c4.1@WebX.raydaftYaTP>,
 Jim <jmt6@cec.wustl.edu> writes:
 >Hi Ross,
 >
 >
 >Thanks for the response. I do have the symbolic toolbox, but I guess
 >I need help in using it and it's commands. Any suggestions? Also,
 >here is the equation that I'm trying to solve (for x):
 >
 >
 >4*p*x*(x^2-1)*(1-(1/x^3))+((2*c)/r)*((x/r)-1)+((k*L)/A)*(x-1)=0
 >
 >

not possible. clearly x=0 is no solution. multiply by x^2.


you get a fifth order polynomial. roots will do it numerically,
but no symbolic solution will be possible because of the mix of
terms in x^5, x^4 , x^3, x .
exception r=1, then you can divide out (x-1), a quartic remains which
can be done analytically.
hth
peter

Subject: Solving a nonlinear equation symbolically

From: Mech Princess

Date: 20 Jul, 2012 16:00:26

Message: 6 of 7

Did you get a solution for this thread?
I am trying to do something similar using sym

I declare the variables using sym or syms
then i have an equation a+2*b=1;
I want MATLAB to give me a=1-2*b;
or alternatively b=(1-a)/2;
is there a way to do this?

Subject: Solving a nonlinear equation symbolically

From: Alan_Weiss

Date: 20 Jul, 2012 19:39:51

Message: 7 of 7

On 7/20/2012 12:00 PM, Mech Princess wrote:
> Did you get a solution for this thread?
> I am trying to do something similar using sym
>
> I declare the variables using sym or syms
> then i have an equation a+2*b=1;
> I want MATLAB to give me a=1-2*b;
> or alternatively b=(1-a)/2;
> is there a way to do this?

doc solve

For example,
syms a b
solve(a+2*b==1,a)

ans =

1 - 2*b

Alan Weiss
MATLAB mathematical toolbox documentation

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us