Clear Filters
Clear Filters

how to make smoother surf plot

1 view (last 30 days)
Junseob Kim
Junseob Kim on 2 Dec 2019
Commented: Junseob Kim on 2 Dec 2019
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 Comments
Luna
Luna on 2 Dec 2019
Edited: Luna on 2 Dec 2019
Yes, you can use several smoothing algorithms. By default it uses moving average.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!