问题
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!
回答1:
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.
来源:https://stackoverflow.com/questions/11114101/how-to-convert-mupad-symbol-i-sqrt-1-to-i-in-matlab