Symbolic division by zero

7 views (last 30 days)
Gonzalo
Gonzalo on 6 Apr 2015
Edited: Gonzalo on 6 Apr 2015
I'm trying to make symbolic variable and then apply a fourier transform to a function that has that same symbolic variable, but when I try to use subs to change the symbolic variable to numbers the following error appears, due to the fact that there is a division by zero:
Error using mupadmex Error in MuPAD command: Division by zero. [_power]
Evaluating: symobj::trysubs
Error in sym/subs>mupadsubs (line 139) G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 124) G = mupadsubs(F,X,Y);
Is there any way I can use a try catch command to suppress the error? I'd like to do the following, but don't really know how.
x=syms('x')
A=-i/x
t=-10:0.001:10
try
G=subs(A,t)
catch EM
G(find(t==0))=Inf
end
My output would have to be the vector but with the Inf somewhere in there. The problem I get when I use this last code is that when it detects the catch it stops and the next numbers are never calculated for the array. Any suggestions on how to solve this problem? Thank you

Answers (0)

Community Treasure Hunt

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

Start Hunting!