Savitsky-Golay Filter Problem - Smoothing 3D line

V
Victoria · Feb 12, 2021 · 1.9K views
Question
I wanted to smooth a 3d line using the Savitzky-Golay filter, but for this example is seems to not work properly. Any ideas why, and how to fix it?     % Savitzky–Golay filter (sgolayfilt) - smoothing individual axes windowWidth = 27; %Standard example values polynomialOrder = 3; xsg=sgolayfilt(points(:,1),polynomialOrder, windowWidth); ysg=sgolayfilt(points(:,2),polynomialOrder, windowWidth); zsg=sgolayfilt(points(:,3),polynomialOrder, windowWidth); xyzsg = [xsg,ysg,zsg]; clf() hold on plot3(points(:,1),points(:,2),points(:,3),'bo') plot3(xyzsg(:,1),xyzsg(:,2),xyzsg(:,3),'gx') hold off
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Aug 24, 2026
How many elements are in your array? 27 looks like an incredibly wide window for your data. I would have used a width of 5 to 9 elements. Try that and see how it works out.

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!