Quadratic interpolation of an N dim array
Show older comments
Hello I would to know how I can perform a quadratic interpolation of an array using matlab ? it is worth mentioning that I am using interp1 for now. thank you!
Accepted Answer
More Answers (1)
Walter Roberson
on 26 Apr 2018
A = [x(:).^2, x(:), ones(numel(x),1)];
b = y;
coefficients = (A\b).';
This code is fine with x being either a row vector or column vector. The code expects that you are doing the quadratic fitting over each column of y independently (not over the rows.)
The array of coefficients that results will be N x 3 where N is the number of columns of y. The order of the coefficients will be the x^2 coefficient, then the x coefficient, then the constant.
Categories
Find more on Interpolation 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!