exp(t^2) function error in zero .

4 views (last 30 days)
ghassen
ghassen on 13 Jan 2015
Answered: John D'Errico on 13 Jan 2015
Hello
I typed the symbolic function exp(t^2) using Matlab symbolic toolbox. When trying to evaluate the function in 0 I got the following error :
_Error using sym>checkindex (line 1562) Index must be a positive integer or logical.
Error in sym>privformatscalar (line 1509) checkindex(x);
Error in sym>privformat (line 1493) s = privformatscalar(x);
Error in sym/subsref (line 707) [inds{k},refs{k}] = privformat(inds{k});_
Can anyone explain me what is going wrong ? Thanks in advance

Accepted Answer

John D'Errico
John D'Errico on 13 Jan 2015
syms t
F = exp(t^2);
subs(F,0)
ans =
1
Works fine for me.
My guess is you defined a variable called exp. Or maybe something silly like like subs. Try typing whos at the command line, and look to see if you defined a variable with a name that is allocated normally to some function you then tried to use.
The simple answer is ... DON'T DO THAT! When you name a variable with something like exp, and then try to use the FUNCTION exp, MATLAB gets confused. Wouldn't you? MATLAB is sitting there, trying to figure out, which exp does he want me to use? How can MATLAB know that you have done this?

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!