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

4 ビュー (過去 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 Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by