exp(t^2) function error in zero .

3 次查看(过去 30 天)
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

采纳的回答

John D'Errico
John D'Errico 2015-1-13
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?

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by