Is there any way I can make the attached contour plots more smooth ?
古いコメントを表示
I have attached two contour plots for pressure field outside an ellipse. The contour plots I got are jagged, may be due to the numerical integration I am using to calculate the pressure fields.The two plots are with Gaussian points 15000 and 5000 respectively. It is observable that with more Gaussian points, the contour plots are becoming smooth, but it is also taking time. Is there any other way to get smooth contour lines.
採用された回答
その他の回答 (4 件)
KSSV
2017 年 8 月 6 日
0 投票
You should be plotting the contours from a matrix say Z..you can increase the dimensions of this matrix using imresize. If you have spatial data matrices X and Y also, you may go for interpolation using interp2.
Chad Greene
2017 年 8 月 6 日
I like KSSV's option of using imresize, because it performs antialiasing before interpolation. To scale by 1/5,
sc = 1/5; % scaling factor
contour(imresize(X,sc),imresize(Y,sc),imresize(Z,sc))
res = ?;
lambda = ?;
Zf = filt2(Z,res,lambda,'lp');
contour(X,Y,Zf)
where you'll have to enter res, which is the pixel size in x,y; and you'll have to enter lambda, the approximate lowpass wavelength.
Teja Muppirala
2017 年 8 月 7 日
編集済み: Teja Muppirala
2017 年 8 月 7 日
Maybe a median filter? However ORDFILT2 needs the Image Processing Toolbox.
Z = peaks(501); % Sample data
Z = Z +0.1*randn(size(Z));
Z(abs(Z)<0.5) = 0;
subplot(211);
contourf(Z);
title('original')
subplot(212);
rad = 5; %Filter radius
[x,y] = meshgrid(-rad:rad);
filtArea = x.^2+y.^2 <= rad.^2; % Use a round filter
Zfilt = ordfilt2(Z,ceil(nnz(filtArea)/2),filtArea);
contourf(Zfilt);
title('filtered')

jacob faerman
2018 年 1 月 15 日
0 投票
The median filter worked nicely for me, and filter2 does not need the image processing toolbox.
カテゴリ
ヘルプ センター および File Exchange で Blue についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


