How to make smoothen 3D surf plot?
Show older comments
Hello,
I'm having a surf plot with spikes. I was wondering how i can do to smooth it.
When I search for methods about this problems,
"interp2" function might be a solution. but, I'm having problems with the dimension and did not manage to do so.
- I have a matrix (data.GX1) of dimension 60X162 for X values in surf function.
- I have a matrix (data.GY1) of dimension 60X162 for Y values in surf fucntion.
- I have a matrix (data.Y1) of dimension 60X162 for Z values in surf fucntion.
If possible, I would appreciate it if you could write a code using interp2.
Otherwise, I'd be very glad for some hints on how to do this.
%% Code : Question about "How to smooth surf spikes"
clear ; close all; clc
load('data.mat')
% GX1 = data.GX1; "X values" in struture.
% GY1 = data.GY1; "Y values" in struture.
% Y1 = data.Y1; "Z values" in struture.
%% Define Colormap
fig.colormap = load('Question.mat').Question; % Colormap Name : Question
%% Figure
tp.ax{1,1} = figure(1);
set(tp.ax{1,1},'OuterPosition',[170,140,1600,1000]);
% Plotting : Surf
tp.h1 = surf(data.GX1,data.GY1,(-1)*data.Y1); hold on;
set(tp.h1,'FaceAlpha',1,'Edgecolor','interp','LineStyle','none','Marker','none');
shading interp;
colormap(fig.colormap);
tp.Cb = colorbar;
caxis([-10 16]);
set(tp.Cb,'Ticks',-10:2:16);
tp.Cb.Label.FontSize = 30;
tp.Cb.Label.String = {'Depth variation (cm)'};
axis equal
xlabel('Distance from the center zone (cm)','Fontsize',12);
ylabel('Distance from the center zone (cm)','Fontsize',12);
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

