How to convert Mupad symbol 'I' {sqrt(-1)} to 'i' in matlab

扶醉桌前 提交于 2019-12-11 20:13:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!