how to fix Warning: Imaginary parts of complex X and/or Y arguments ignored
6 views (last 30 days)
This is the line of code the warning pops up for.
my initial conditions are
% yo = [Fa,Fb,Fc,Fd,Fe,Ff,T,x,P]
yo = [9.614 19.435 0 0 35.03391 0 870 0 101.325]
and my V is calculated by
V = ((FA+FB+FC+FD+FE+FF)*R*T)/P
hope someone can help with this!
Paul Hoffrichter on 2 Apr 2021
Edited: Paul Hoffrichter on 2 Apr 2021
If you have a negative number raised to a non-integer power, you can sometimes get a complex number. Take a look at:
In this case, there was a very small percentage of complex numbers. Maybe the plot routine knew what was best for the writer by converting automatically the complex numbers to real. The other numbers were real. Matlab is a smart cookie.