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:
equation solving

Subject: equation solving

From: Vaibhav

Date: 20 May, 2010 07:38:06

Message: 1 of 5

I want to enter a equation of the form s^3+s^2+s^1+1
But when I enter it gives an error message of unknown variable s.
I need equation in this form only,since it is to be used further, for dividing another equation.
Please help.

Subject: equation solving

From: mat001

Date: 20 May, 2010 14:20:23

Message: 2 of 5

"Vaibhav " <vaibhav15211@gmail.com> wrote in message <ht2osu$9u4$1@fred.mathworks.com>...
> I want to enter a equation of the form s^3+s^2+s^1+1
> But when I enter it gives an error message of unknown variable s.
> I need equation in this form only,since it is to be used further, for dividing another equation.
> Please help.

define s
just like i did a small test to understand
s = rand(1,100);
t = s.^3+s.^2+s.^1+1

Subject: equation solving

From: Walter Roberson

Date: 20 May, 2010 14:27:35

Message: 3 of 5

Vaibhav wrote:
> I want to enter a equation of the form s^3+s^2+s^1+1
> But when I enter it gives an error message of unknown variable s.
> I need equation in this form only,since it is to be used further, for
> dividing another equation.

s^3+s^2+s^1+1 is an expression, not an equation. An equation would have
to have an '=' in it somewhere.

Symbolic expressions and functions and formula can only be represented
in Matlab if you have the Symbolic Toolbox (which is part of the Student
Edition.) If you do have the Symbolic Toolbox, see the documentation for
sym()

Subject: equation solving

From: Roger Stafford

Date: 20 May, 2010 14:43:05

Message: 4 of 5

"Vaibhav " <vaibhav15211@gmail.com> wrote in message <ht2osu$9u4$1@fred.mathworks.com>...
> I want to enter a equation of the form s^3+s^2+s^1+1
> But when I enter it gives an error message of unknown variable s.
> I need equation in this form only,since it is to be used further, for dividing another equation.
> Please help.

  Your system is not smart enough, unless you use the 'solve' function in the symbolic toolbox, to realize that with an s referenced by that equation, you are referring to any one of the three possible solutions to the equation: 1, i, -i. Try using 'solve', or better still, 'roots' to see this.

  Be warned however that from polynomial degree five on, there is no general solution to such polynomial equations in terms that would permit you to give a straightforward expression for them.

Roger Stafford

Subject: equation solving

From: Steven Lord

Date: 20 May, 2010 16:23:33

Message: 5 of 5


"Vaibhav " <vaibhav15211@gmail.com> wrote in message
news:ht2osu$9u4$1@fred.mathworks.com...
>I want to enter a equation of the form s^3+s^2+s^1+1
> But when I enter it gives an error message of unknown variable s.
> I need equation in this form only,since it is to be used further, for
> dividing another equation.
> Please help.

Use Symbolic Math Toolbox or enter the equation in a string and convert it
into an anonymous function with STR2FUNC.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

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