How to create and save the contourf image to pixel by pixel and the grey-level from 0-192

조회 수: 2 (최근 30일)
Hello, I am a beginner at Matlab. I would like to create contourf plot. The plot size is pixel by pixel, and the grey level from 0-192. The code as below,
r_M = [4.76083603812144 4.59732757325507 3.84078375990161 2.83522761891933 2.03979313208838 1.61429885435575 1.58483400872700 2.07651813385661 2.55722735199852 2.72392206632444 2.93752535716962 3.36165244504211 4.22402540734126
5.09135259357986 5.14098053905767 3.84735386504628 2.90588398495713 2.16965294670956 1.75800774970059 1.60816653904618 2.09786569025139 2.35707830751551 2.72724672816220 2.92950291189290 3.14937669175105 3.55234768789906
5.32921037462212 5.19557229019368 3.64288236574948 2.59423164048293 2.05593607322099 1.62600765104696 1.39272324365209 1.94639828163833 2.39067573713014 2.76682320807590 3.08555090153314 3.34114325174325 3.48149717381015
5.32220300581207 4.77648710556025 3.33861857929257 2.30001087201542 1.72605713634148 1.30014731381246 1.27834395153522 1.44070837985961 2.28502229697568 3.05248804492776 3.46260438310124 3.48706102771820 3.51030149578596
4.77942253753882 4.46906792789553 3.34795711428994 2.16465765653945 1.46191531056537 0.977488872989844 0.753852737116531 1.27219788209603 2.08210681473467 3.03256963334665 3.64937747540501 3.65792537276952 3.74565551110235
4.35299275691490 4.09126935363725 3.17753495331855 2.00277281204170 1.24584659356560 0.971882708826663 0.359926751275065 0.750288700163987 1.65295259354634 2.78437256856132 3.88785048392134 4.12080325961920 3.91064049184246
3.93553132820880 3.59037099875034 3.00742566363658 2.22310301463755 1.40329829105446 0.641720673990197 0 0.353817971764671 1.25050401867387 2.52705374697445 3.90206241164242 4.23322992408431 4.07966270942597
3.81297584814867 3.50496940639607 3.07287706439689 2.35995332346616 1.86413217218313 0.936682281145216 0.260044105867860 0.421385784308465 1.16132826321159 2.46123588438794 4.02775557593691 4.61512984501341 4.56460461007416
3.68529588244402 3.45724972352478 3.08758001482871 2.71853149527819 2.01589401870171 1.20354143807865 0.587935492605682 0.670452733954317 1.32097352990551 2.73396811354949 3.39007402374409 5.12073156989824 5.19172525646325
3.57346310861397 3.30138171990411 2.94197749316414 2.76413214744990 2.20208725235252 1.60173122994903 1.11863252129357 1.05812096331277 1.41869726718747 2.25935488759645 3.69156460669313 5.55839137321558 5.66354993152361
3.65235145805927 3.17599433524990 2.86927834788569 2.62713472885208 2.18853259171050 1.85215737698314 1.37566911617467 1.43058696816551 1.71420712042859 2.17640898749974 3.77395656277310 5.85285012374981 6.21778688895472
3.88096688920101 3.25616920202222 2.94078301742807 2.49926413516375 2.08893540306161 1.76158511353697 1.58802372581860 1.49797801272054 1.65308574844975 2.50599597127705 3.97368783274096 6.05695466074494 6.57069113812358
4.49676159104381 3.28110982226297 2.97248320745266 2.51555310405689 2.18534801655490 1.67462553900224 1.32835750776993 1.30126235023730 1.60772857482591 2.41658242378975 3.88480146299220 5.64471842496219 6.78487213551137];
Max = max (r_M (:));
Min = min(r_M(:));
I = mat2gray(r_M,[Min Max]);
figure(104)
contourf(X,Y,b,256,'LineColor','none')
colormap(flipud(gray(256)));
set(gca,'xtick',[])
set(gca,'ytick',[])
Thanks a lot.
  댓글 수: 3
Tina Hsiao
Tina Hsiao 2021년 3월 25일
X=[
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150
-150 -125 -100 -75 -50 -25 0 25 50 75 100 125 150]
Y =[
-150 -150 -150 -150 -150 -150 -150 -150 -150 -150 -150 -150 -150
-125 -125 -125 -125 -125 -125 -125 -125 -125 -125 -125 -125 -125
-100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
-75 -75 -75 -75 -75 -75 -75 -75 -75 -75 -75 -75 -75
-50 -50 -50 -50 -50 -50 -50 -50 -50 -50 -50 -50 -50
-25 -25 -25 -25 -25 -25 -25 -25 -25 -25 -25 -25 -25
0 0 0 0 0 0 0 0 0 0 0 0 0
25 25 25 25 25 25 25 25 25 25 25 25 25
50 50 50 50 50 50 50 50 50 50 50 50 50
75 75 75 75 75 75 75 75 75 75 75 75 75
100 100 100 100 100 100 100 100 100 100 100 100 100
125 125 125 125 125 125 125 125 125 125 125 125 125
150 150 150 150 150 150 150 150 150 150 150 150 150]

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by