Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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.

Akzeptierte Antwort

Meghana Dinesh
Meghana Dinesh am 6 Feb. 2016
Bearbeitet: Meghana Dinesh am 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 Kommentare
MichaelTee
MichaelTee am 6 Feb. 2016
I tried your code and it gives me a specific answer. I want to simplify an expression. Not get a specific answer.
Walter Roberson
Walter Roberson am 6 Feb. 2016
simplify() requires the Symbolic Toolbox, and it works on symbolic expressions.
syms x
simplify( sin(x)^2 + cos(x)^2 )

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Bala Abhirami
Bala Abhirami am 25 Mai 2021
Bearbeitet: Bala Abhirami am 25 Mai 2021
The function u[1]/(u[2]^0.5) shows the error "result of the function is undefined" in matlab simulink user defined function. What could be the reason?

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by