Fitting scattered data to multiple cosine functions
Afficher commentaires plus anciens

Hello,
I have data that represent 16 cosine shaped curves, but the data is in the form of scattered points (x_i y_i) i= 1,2,3 .... N. please relate to the attached plot. The points are not associated to the functions, further more, I don't have the exact functions but only their models, more specifically, each function follows the form: f_k = A_k cos(phi_0k + omega*x), omega is fixed for all the functions, only the amplitude A_k and the phase shift phi_k are specific to each function. Is there an easy way to associate each data point to one of the 16 curves?
Thanks in advance.
6 commentaires
KALYAN ACHARJYA
le 11 Juil 2018
How can you link the scattered points with cosine signal?
f_k = A_k cos(phi_0k + omega*x)
What is x here, is it time?
Ahmad Hamad
le 11 Juil 2018
Modifié(e) : Ahmad Hamad
le 11 Juil 2018
dpb
le 11 Juil 2018
"Easy?" Not possible to have a unique solution in all likelihood with no additional information.
But, attach your data file and maybe somebody will give it a shot and see what happens.
Anton Semechko
le 11 Juil 2018
Modifié(e) : Matt J
le 11 Juil 2018
Two or more curves intersect at multiple points and data is a bit noisy in some places. Combined effect of these observations is that it will not be possible to assign each data point to a single curve. Unique assignments can be made for the majority of the data points, but not the ones that lie close to the points of intersection. Still, doing so will not be "easy" as you will first have to use nonlinear least squares to estimate parameters (i.e., amplitudes and phase-shifts) of the 16 curves.
Ahmad Hamad
le 11 Juil 2018
Modifié(e) : Ahmad Hamad
le 11 Juil 2018
dpb
le 11 Juil 2018
Well, that's the issue; if you just throw all the data at a NLLSQ algorithm trying to estimate 32 parameters (mag and phase for sixteen functions), it'll fail miserably unless you have some way a priori to associate which point(s) belong to which term; otherwise it just looks basically like random noise.
Réponse acceptée
Plus de réponses (1)
Matt J
le 11 Juil 2018
0 votes
You need to implement a sort of sinusoidal Hough transform. Bin the 2D space of coordinates (A,phi) into cells and loop over the cells. For each combination (A,phi), generate the appropriate curve y=f(x) and see how many points lie within a tolerance region of that curve. This will give you a tableau Counts(A,phi). The top 16 peaks in that tableau will give you your 16 sinusoids.
3 commentaires
dpb
le 11 Juil 2018
Ah...that's not a bad idea at all...
Ahmad Hamad
le 12 Juil 2018
Matt J
le 12 Juil 2018
You could start with coarse sampling, e.g., 10x10x10 and gradually refine.
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

