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:
Symbolic expressions

Subject: Symbolic expressions

From: Shishir Jaiswal

Date: 16 Feb, 2013 14:06:18

Message: 1 of 6

I need to define a positive symbolic expression say 'n'.
I am using 'sym' or 'syms' (for multiple symbols). In one machine (PC) it is working fine but in another following error is coming:

?? Undefined function or method 'sym' for input arguments of type 'char'.

what may be the reason? i am using same version in both the systems.
Is there any other way of defining math symbols?

Subject: Symbolic expressions

From: Steven_Lord

Date: 18 Feb, 2013 03:22:28

Message: 2 of 6



"Shishir Jaiswal" <shishirjaiswal_18@yahoo.com> wrote in message
news:kfo3oq$44e$1@newscl01ah.mathworks.com...
> I need to define a positive symbolic expression say 'n'.
> I am using 'sym' or 'syms' (for multiple symbols). In one machine (PC) it
> is working fine but in another following error is coming:
>
> ?? Undefined function or method 'sym' for input arguments of type 'char'.
>
> what may be the reason? i am using same version in both the systems.
> Is there any other way of defining math symbols?

Both SYM and SYMS are functions from Symbolic Math Toolbox.

http://www.mathworks.com/help/symbolic/sym.html

On the first machine, you have this toolbox installed. On the second
machine, you do not. You can confirm this by looking at the output of the
VER function.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Symbolic expressions

From: Shishir Jaiswal

Date: 18 Feb, 2013 08:32:07

Message: 3 of 6

"Steven_Lord" <slord@mathworks.com> wrote in message <kfs6pk$lk1$1@newscl01ah.mathworks.com>...
>
>
> "Shishir Jaiswal" <shishirjaiswal_18@yahoo.com> wrote in message
> news:kfo3oq$44e$1@newscl01ah.mathworks.com...
> > I need to define a positive symbolic expression say 'n'.
> > I am using 'sym' or 'syms' (for multiple symbols). In one machine (PC) it
> > is working fine but in another following error is coming:
> >
> > ?? Undefined function or method 'sym' for input arguments of type 'char'.
> >
> > what may be the reason? i am using same version in both the systems.
> > Is there any other way of defining math symbols?
>
> Both SYM and SYMS are functions from Symbolic Math Toolbox.
>
> http://www.mathworks.com/help/symbolic/sym.html
>
> On the first machine, you have this toolbox installed. On the second
> machine, you do not. You can confirm this by looking at the output of the
> VER function.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com


thank you sir but how to install it in another PC?

Subject: Symbolic expressions

From: Steven_Lord

Date: 19 Feb, 2013 18:23:03

Message: 4 of 6



"Shishir Jaiswal" <shishirjaiswal_18@yahoo.com> wrote in message
news:kfsou7$ihs$1@newscl01ah.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <kfs6pk$lk1$1@newscl01ah.mathworks.com>...

*snip*

> thank you sir but how to install it in another PC?

The exact details may depend on the exact details of your license; contact
the person in charge of maintaining your license or contact MathWorks
Technical Support.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Symbolic expressions

From: Christopher Creutzig

Date: 20 Feb, 2013 13:58:38

Message: 5 of 6

On 16.02.13 15:06, Shishir Jaiswal wrote:
> I need to define a positive symbolic expression say 'n'.
> I am using 'sym' or 'syms' (for multiple symbols). In one machine (PC) it is working fine but in another following error is coming:

Just a quick note: The difference between sym and syms is not whether
you want a single or multiple symbols. It is true that syms can create
multiple symbols at the same time, but the primary difference is that
syms assigns the symbolic variable to the name given:

>> sym x

ans =

x

>> whos
  Name Size Bytes Class Attributes

  ans 1x1 112 sym

>> syms x
>> whos
  Name Size Bytes Class Attributes

  ans 1x1 112 sym
  x 1x1 112 sym

Also, sym can handle expressions, while syms only defines variables and
abstract functions. Note that entering expressions into sym is not
really recommended, since the syntax is subtly different from MATLAB
expressions.


HTH,
Christopher

Subject: Symbolic expressions

From: Steven_Lord

Date: 20 Feb, 2013 14:26:54

Message: 6 of 6



"Christopher Creutzig" <Christopher.Creutzig@mathworks.com> wrote in message
news:5124D68E.6060500@mathworks.com...
> On 16.02.13 15:06, Shishir Jaiswal wrote:
>> I need to define a positive symbolic expression say 'n'.
>> I am using 'sym' or 'syms' (for multiple symbols). In one machine (PC) it
>> is working fine but in another following error is coming:
>
> Just a quick note: The difference between sym and syms is not whether
> you want a single or multiple symbols. It is true that syms can create
> multiple symbols at the same time, but the primary difference is that
> syms assigns the symbolic variable to the name given:
>
>>> sym x
>
> ans =
>
> x
>
>>> whos
> Name Size Bytes Class Attributes
>
> ans 1x1 112 sym
>
>>> syms x
>>> whos
> Name Size Bytes Class Attributes
>
> ans 1x1 112 sym
> x 1x1 112 sym
>
> Also, sym can handle expressions, while syms only defines variables and
> abstract functions. Note that entering expressions into sym is not
> really recommended, since the syntax is subtly different from MATLAB
> expressions.

One more big difference, and the reason I try always to use SYM instead of
SYMS when defining a symbolic variable inside a function, is that SYMS
"poofs" variables into the workspace. The SYM function, when called with an
output argument, does not.


function showpoof
peaks;
syms alpha
% The next line calls the ALPHA function. It does NOT attempt to index into
the variable with an index of 0.5
alpha(0.5)

beta = sym('beta');
% This next line does NOT call the BETA function.
beta(1, 1)


When you run this, you should see a translucent PEAKS surface (assuming you
have Symbolic Math Toolbox installed) and the variable beta should be
displayed in the Command Window.

--
Steve Lord
slord@mathworks.com
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