Warning: Imaginary parts of complex X and/or Y arguments ignored.
4 ビュー (過去 30 日間)
Error when attempting to plot ,the first imaginary result comes from Q3 afterwards everything that involves Q3 results as imaginary , i tried doing q3=sqrt(h3)*k; Q3=real(q3); and got rid of the imaginary result (i think) but when trying to plot my plot is empty
%% initial data
p32 = [1.22 1.225 1.225 1.22 0.765 0.085];
p33 = [0.660 0.660 0.665 0.655 0.435 0.085];
p34 = [0.830 0.830 0.830 0.815 0.540 0.105];
p39 = [0.705 0.705 0.730 0.690 0.460 0.085];
p40 = [0.410 0.410 0.405 0.400 0.285 0.090];
grid on;axis tight;
Haven't tried your code, but most likely one or more of h1, h2, or h3 are negative and when you take the square root of them it generates a complex value. In the future please include the error in the body of your question and put a more descrptive subject in
I looked at your code a little more. The problem is in the last element of h3. Since p39(4) = 0.085 and p40(4) = 0.090 the last element of h3 = p39-p40 is negative. Then on line 21 you compute Q3 as sqrt(h3)*k which gives a purely imaginary result in the fourth element of Q3, and as you say the problems cascade from there.
Rather than trying to mask the problem by taking just real parts I think you need to figure out what your physical interpertation is of the negative, what looks like a pressure difference, is in the fourth term of h3.
Looks like maybe the flow is reversed. If you just care about the magnitude of the flows and not the directions I would suggest computing
h3 = sqrt(abs(h3))*k
その他の回答 (0 件)
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!