Using polyfit in two arrays to detrend data.
9 次查看(过去 30 天)
显示 更早的评论
I have two 5x1 arrays (x and y oth come from one data table) and need to use them to detrend a data set. My line of code to do so is below. I keep getting the error of "arrays have incompatible array sizes for this operation." My question is, what can I do to make the array sizes work with the polyfit?
data_detrend = data-polyfit(x,y,4)
0 个评论
更多回答(1 个)
Alan Stevens
2023-6-13
编辑:Alan Stevens
2023-6-13
polyfit just returns the coefficients of the polynomial. You need to use them in polyval to calculate data values.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!