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

조회 수: 7 (최근 30일)
Balaji Ramdas
Balaji Ramdas 2022년 1월 3일
답변: KSSV 2022년 1월 3일
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));

답변 (1개)

KSSV
KSSV 2022년 1월 3일
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

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by