how to plot a contour map using a matrix for X, Y and Z values?

3 Ansichten (letzte 30 Tage)
Philippe Corner
Philippe Corner am 18 Mär. 2018
Bearbeitet: John D'Errico am 18 Mär. 2018
M matrix is:
M = [0 5 10 15 20 25 30 35 40 45
5 0.0137945780000000 0.0140902780000000 0.0141900320000000 0.0142399090000000 0.0142897860000000 0.0143111620000000 0.0143289750000000 0.0143432260000000 0.0143503510000000
10 0.0211336350000000 0.0218034130000000 0.0220955500000000 0.0222238060000000 0.0223413730000000 0.0223983750000000 0.0224304390000000 0.0224731910000000 0.0224803160000000
15 0.0293099150000000 0.0304570880000000 0.0309416080000000 0.0311945560000000 0.0313833770000000 0.0314795680000000 0.0315330080000000 0.0315900100000000 0.0316113860000000
20 0.0383127290000000 0.0401261180000000 0.0408457730000000 0.0412590400000000 0.0415333640000000 0.0416723080000000 0.0417684990000000 0.0418468770000000 0.0418753790000000
25 0.0486978520000000 0.0512202070000000 0.0522711890000000 0.0528697140000000 0.0532758560000000 0.0534718020000000 0.0536249960000000 0.0537247500000000 0.0537746270000000
30 0.0601945210000000 0.0635255980000000 0.0649399690000000 0.0657807550000000 0.0663151520000000 0.0665859130000000 0.0667818590000000 0.0669172400000000 0.0669778050000000
35 0.0730877480000000 0.0774769320000000 0.0794007620000000 0.0804838080000000 0.0811927750000000 0.0815561650000000 0.0818411770000000 0.0819979340000000 0.0820976880000000
40 0.0854358900000000 0.0909188070000000 0.0933699100000000 0.0946987780000000 0.0955823150000000 0.0960347710000000 0.0963874740000000 0.0965834190000000 0.0967366130000000
45 0.0994477890000000 0.106052941000000 0.109099006000000 0.110823328000000 0.111820870000000 0.112383769000000 0.112818412000000 0.113057109000000 0.113228116000000];
How to plot a contour graph using the matrix M.. the first row and the first column of matrix M would be the coordinates for each value.. for example:
for the coordinates 5,5 the z value for the contour map would be 0.01379458 and for the coordinates 30,20 the z value would be 0.06578076. the idea is to plot all the coordinates of matrix M and use the z values for the contour plot.
What could be the best way to solve it?
  1 Kommentar
John D'Errico
John D'Errico am 18 Mär. 2018
Bearbeitet: John D'Errico am 18 Mär. 2018
Why not just call contour?
doc contour
Do you want to plot the surface, with iso-levels plotted as contour lines on the surface itself?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 18 Mär. 2018
x = M(1,2:end);
y = M(2:end,1);
[X,Y]=meshgrid(x,y);
Z=M(2:end,2:end) ;
Now use contour on X,Y and Z.

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