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일
Have you tried to smooth your data with smooth function?
Junseob Kim
Junseob Kim 2019년 12월 2일
No. I didn't know about that function. Do you think that would be working?
Luna
Luna 2019년 12월 2일
편집: Luna 2019년 12월 2일
Yes, you can use several smoothing algorithms. By default it uses moving average.
Junseob Kim
Junseob Kim 2019년 12월 2일
Thanks!!

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

답변 (0개)

카테고리

태그

질문:

2019년 12월 2일

댓글:

2019년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by