Warning: Imaginary parts of complex X and/or Y arguments ignored.

2 views (last 30 days)
I keep getting this error messgae when plotting some quantaties. My code points out that U_T is a cmplex double which is not true. So, I am not sure what is the problem, I know it happens in Line and in function C2P but I do not see how
gamma = 1.4;
sigmma = 1.0;
CFL = 0.1;
tend = 0.125;
N_max = 10000;
dx = 0.001;
L = 1;
x = 0:dx:L;
N = length(x);
rho1 = 1.0;
p1 = 1.0;
u1 = 0.0;
v1 = 0.0;
w1 = 0.0;
Bx1 = 0.0;
By1 = 0.0;
Bz1 = 0.0;
rho5 = 0.125;
p5 = 0.1;
u5 = 0.0;
v5 = 0.0;
w5 = 0.0;
Bx5 = 0.0;
By5 = 0.0;
Bz5 = 0.0;
VL = [rho1; u1; v1; w1; p1; Bx1; By1; Bz1];
VR = [rho5; u5; v5; w5; p5; Bx5; By5; Bz5];
I will attach my functions in case you wanna give it a run. But can someone help me understand the problem better. Thanks
  2 Comments
the cyclist
the cyclist on 27 Apr 2021
I did try to run your code, but it errored at the line
[U_T, t] = MacCormack(U_T, gamma, t, dx, CFL, sigmma); % error here
Unrecognized function or variable 'MacCormack'

Sign in to comment.

Accepted Answer

Jamie Al
Jamie Al on 27 Apr 2021
Thanks, but I found the error was a negative sign in a rooted term that needed an abs function to solve it.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!