If you want to get rid of the zero-valued imaginary part of the solution you can use sym/real: real(y) You might also submit this case to The MathWorks as a service request in case they'd consider improving the simplification for this and similar equations. Unfortunately, Matlab's simplification routines appear to not be able to reduce this expression when assumptions are included. Or you can use more symbolic math via the isAlways function to show this: syms x real With a bit of math you can show that the solution is always real for x>=5 (see complex logarithm). This solution is valid over the entire domain of of real values, including your restricted domain of x>=5. ![]() This occurs because Matlab's int function returns the full general solution when you ask for the indefinite integral. This behavior is present in R2017b, though when converted to floating point the imaginary components are different.
0 Comments
Leave a Reply. |