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에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

