pcolor - how to smooth
18 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone~
I'm plotting some contour map (x, y, z)
If I use Origin, it does some nice smoothing.
In Maltab, using
pcolor(x, y, z); shading interp;
It shows all the noise.
See the picture please.<https://lh6.googleusercontent.com/-fqdFfNo1k5E/UiDzBmXPjtI/AAAAAAAAAz0/iSuJktzidb8/w1044-h352-no/plot.png>
The 3rd plot is a comparison: when data's not noisy, Matlab produces a flat background part (the blue part) too.
I wonder if there's anyway I can get do the same as in Origin using Matlab. Or do I have to smooth the data myself?
Any thoughts are appreciated. Thanks~
2 件のコメント
回答 (3 件)
Kelly Kearney
2013 年 8 月 30 日
Pretty sure it's just a colormap difference, with origin setting everything less than -90 to black. Try this:
pcolor(x,y,z);
shading interp;
set(gca, 'clim', [-90 -32]);
colormap([0 0 0; jet]);
colorbar;
You'll probably have to fiddle a bit more with the colormap and color limits to get the exact same thing, but that should be close.
Image Analyst
2013 年 8 月 30 日
Can you somehow get an image out of that? Because images are a lot easier to smoother than a list of random coordinates.
2 件のコメント
Image Analyst
2013 年 8 月 30 日
編集済み: Image Analyst
2013 年 8 月 30 日
One way, though not necessarily the best way is to just use convolution to blur each color channel one at a time:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
windowSize = 7;
kernel = ones(windowSize) / windowSize ^ 2;
% Blur the individual color channels.
smoothedPictureR = conv2(double(redChannel), kernel, 'same');
smoothedPictureG = conv2(double(greenChannel), kernel, 'same');
smoothedPictureB = conv2(double(blueChannel), kernel, 'same');
% Recombine separate color channels into a single, true color RGB image.
smoothrgbImage = uint8(cat(3, smoothedPictureR , smoothedPictureG, smoothedPictureB));
imshow(smoothrgbImage);
Usenobong Akpan
2019 年 3 月 15 日
Hi,
Please I am a new user of matlab. i need help on the matlab code that would make me plot a single 3 axes graph. I am comparing power (W) and temp (degree celsius) over same time interval. I can if there were of the same unit i.e. W and W over same time interval; but here I am having difficulty.
pls can anyone help out?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Colormaps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!