Using polyfit in two arrays to detrend data.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Plus de réponses (1)
Alan Stevens
le 13 Juin 2023
Modifié(e) : Alan Stevens
le 13 Juin 2023
polyfit just returns the coefficients of the polynomial. You need to use them in polyval to calculate data values.
Voir également
Catégories
En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!