how to make smoother surf plot

3 次查看(过去 30 天)
Junseob Kim
Junseob Kim 2019-12-2
if n == 1
Hz_snapshots(:,:,snap_count) = Hz; %save the current Hz
Ex_snapshots(:,:,snap_count) = Ex; %save the current Ex
Ey_snapshots(:,:,snap_count) = Ey; %save the current Ey
time_stamp(snap_count) = n; %save the time of the snapshot
snap_count = snap_count + 1; %increase the index for the next snapshot
elseif mod(n,round(nt/(ns-1))) == 0
Hz_snapshots(:,:,snap_count) = Hz; %save the current Hz
Ex_snapshots(:,:,snap_count) = Ex; %save the current Ex
Ey_snapshots(:,:,snap_count) = Ey; %save the current Ey
time_stamp(snap_count) = n; %save the time of the snapshot
snap_count = snap_count + 1; %increase the index for the next snapshot
end
xx = 0:dx:a;
yy = 0:dy:b;
[Y, X] = meshgrid(yy,xx);
surf(X,Y,Hz,'LineStyle','none', 'FaceColor', 'interp')
axis([0 a 0 b -1 1])
title(strcat('Hz Field at Time n = ',num2str(n)))
xlabel('x (m)')
ylabel('y (m)')
zlabel('Hz (V/m)')
Hello guys. I made a plot by using those statements. Hz is 101x81 matrix having the form of a checkerboard.
Ex, Hz= (2680, 0, 2680, 0, 2680;
0, 6308, 0, 6308, 0;
9359, 0, 9359, 0, 9359)
And I want to remove those 'spike shape' from my plot and change it to a smooth plot. How can I do this?
Or, if there is any method to remove '0' values from the Hz matrix and push the other values ​​to the left, and plot it, please let me know.
Thanks!!
  4 个评论
Luna
Luna 2019-12-2
编辑:Luna 2019-12-2
Yes, you can use several smoothing algorithms. By default it uses moving average.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by