MATLAB symbolic function shouldn't be symbolic

In summary, the conversation discusses an error that occurs when running a code, which involves the use of the 'gt' function. The value of "check" is a real number and not symbolic, and the code outputs a value of 1. The solution to the problem is to use check = double(limit(XF,x,0)) in the code.
  • #1
GreenLRan
61
0
[SOLVED]

I am getting this error when I try to run the code (at bottom):

check =

1


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

Error in ==> homework at 15
if check > 10


The value "check" seems to be a real value, not symbolic. It outputs a value of 1 in the terminal. Can anyone help me resolve this problem?


CODE:



clear all
syms z p x;
z = -10;
p = 0;
while p <20
while z < 20
G1 = tf([1 z],[1 p]);
X1 = (x+z)/(x+p);
G2 = tf([1],[1 2.5 1]);
X2 = (1/(x^2+2.5*x+1));
TF = G1*G2/(1+G1*G2);
XF = X1*X2/(1+X1*X2);
z = z + .1;
check = limit(XF,x,0)
if check > 10

[Wn,Z] = damp(TF)
z
p

end
end
p = p+.1;
end
 
Last edited:
Physics news on Phys.org
  • #2
Simply use check = double(limit(XF,x,0)).
 

1. Why is my MATLAB symbolic function not working?

There could be several reasons for this. It could be due to incorrect syntax or variable names, or it could be because the function is not defined properly. Check your code for any errors and make sure the function is defined correctly.

2. Can I use symbolic functions in a MATLAB script or only in the command window?

You can use symbolic functions in both a script and the command window. However, if you are using the function in a script, make sure to define it before using it in the script.

3. How do I convert a symbolic function to a regular function in MATLAB?

To convert a symbolic function to a regular function, you can use the matlabFunction command. This will convert the symbolic function into a regular function handle that can be used in your script.

4. Can I use symbolic functions with arrays or matrices?

Yes, you can use symbolic functions with arrays and matrices in MATLAB. However, the function will be evaluated element-wise, which may not always give the desired result. It is better to use vectorized operations for better performance.

5. Are there any limitations to using symbolic functions in MATLAB?

Yes, there are some limitations to using symbolic functions in MATLAB. These functions are not optimized for computational efficiency, so they may not be suitable for large datasets or complex calculations. It is recommended to use them for small-scale problems or for symbolic manipulation and analysis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
992
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
121
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
934
Back
Top