Fitting scattered data to multiple cosine functions
古いコメントを表示

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 件のコメント
KALYAN ACHARJYA
2018 年 7 月 11 日
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
2018 年 7 月 11 日
編集済み: Ahmad Hamad
2018 年 7 月 11 日
dpb
2018 年 7 月 11 日
"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
2018 年 7 月 11 日
編集済み: Matt J
2018 年 7 月 11 日
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
2018 年 7 月 11 日
編集済み: Ahmad Hamad
2018 年 7 月 11 日
dpb
2018 年 7 月 11 日
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.
採用された回答
その他の回答 (1 件)
Matt J
2018 年 7 月 11 日
0 投票
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 件のコメント
dpb
2018 年 7 月 11 日
Ah...that's not a bad idea at all...
Ahmad Hamad
2018 年 7 月 12 日
Matt J
2018 年 7 月 12 日
You could start with coarse sampling, e.g., 10x10x10 and gradually refine.
カテゴリ
ヘルプ センター および File Exchange で Exploration and Visualization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

