Least Absolute Deviations (L1-norm) line fit - degree n - MATLAB Cody - MATLAB Central

Problem 45854. Least Absolute Deviations (L1-norm) line fit - degree n

Difficulty:Rate
This is a generalization of Problem 45851 for degree n
- - - -
You are given two vectors X and Y (coordinates of observations on a plane), and a degree d of the underlying model. Return a row vector P with the d+1 coefficients of the best-fit polynomial, in the L1-norm sense. I.e., find P of degree d that minimizes sum( abs( Y - polyval(P,X) ) ) .
(compare your results with polyfit on the test suite!)

Solution Stats

45.45% Correct | 54.55% Incorrect
Last Solution submitted on Apr 17, 2021

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
13
5

Problem Recent Solvers2

Suggested Problems

More from this Author10

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page