how to get a contour plot for a matrix with imaginary values

7 Ansichten (letzte 30 Tage)
Balaji Ramdas
Balaji Ramdas am 3 Jan. 2022
Beantwortet: KSSV am 3 Jan. 2022
an error pops up saying the values must be real
p1source=(A1*exp(-j*k0*r1source))./r1source; %pressure from source 1
p2source=(A1*exp(-j*k0*r2source))./r2source; %preassure from source 2
p3source=(A1*exp(-j*k0*r3source))./r3source; %pressure from source 3
Pm1=p1source+p2source+p3source; %total pressure from all three sources
figure(1)
contourf(1:1:10,1:1:6,(pm1));

Antworten (1)

KSSV
KSSV am 3 Jan. 2022
You can plot either ral, imaginary or absolute of the value.
contourf(1:1:10,1:1:6,real(pm1)); % to plot real part
contourf(1:1:10,1:1:6,imag(pm1)); % to plot imaginary part
contourf(1:1:10,1:1:6,abs(pm1)); % to plot absolute

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by