0

I am trying to evaluate this integral in matlab enter image description here

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!

Amro
  • 123,847
  • 25
  • 243
  • 454
claws
  • 52,236
  • 58
  • 146
  • 195

1 Answers1

0

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.

Ole Thomsen Buus
  • 1,333
  • 1
  • 9
  • 24