I am trying to evaluate this integral in matlab
matlab is treating 'ans' as a symbol because of 'I'. How to convert this 'I' into 'i' so that ans becomes a complex number.
much appreciated!
I am trying to evaluate this integral in matlab
matlab is treating 'ans' as a symbol because of 'I'. How to convert this 'I' into 'i' so that ans becomes a complex number.
much appreciated!
The symbolic math toolbox has an overloaded double
function that can be used to convert from sym
to double
representation (if the expression is a symbolic constant or is a constant expression).
For example:
ans_sym = vpa(1+1*i);
ans_double = double(ans_sym);
Look here for more information: http://www.mathworks.se/help/toolbox/symbolic/double.html.