# I'm trying to simplify an expression or equation symbolically and I get the same error every time. Undefined function or variable 'x'.

8 views (last 30 days)

Show older comments

I'm trying to simplify an expression symbolically and I get the same error every time.

Undefined function or variable 'x'.

I'm even using the actual example matlab provides. Trying to just simplify the expression sin(x)^2 + cos(x)^2 I get the error everytime. I'm brand new...what am I missing.

##### 0 Comments

### Accepted Answer

Meghana Dinesh
on 6 Feb 2016

Edited: Meghana Dinesh
on 6 Feb 2016

What exactly is your command? It seems like you haven't told MATLAB what the value of x is. First, initialize a value for x and the carry on.

x = 0.5;

sin(x)^2 + cos(x)^2;

##### 4 Comments

Walter Roberson
on 6 Feb 2016

simplify() requires the Symbolic Toolbox, and it works on symbolic expressions.

syms x

simplify( sin(x)^2 + cos(x)^2 )

### More Answers (1)

Bala Abhirami
on 25 May 2021

Edited: Bala Abhirami
on 25 May 2021

##### 1 Comment

Walter Roberson
on 25 May 2021

Simulink uses MATLAB indexing syntax, so you need () instead of []

u(1)/(u(2)^0.5)

You might be able to use

u(1)/sqrt(u(2))

### See Also

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!