Sinusoidal fit with fixed points

조회 수: 2 (최근 30일)
curoi
curoi 2015년 1월 19일
편집: Matt J 2015년 1월 22일
Is there a way to fit a sine curve to some data points but hold some of the fitted points at known locations? I'm trying to hold the extrema constant because they are known points but the rest of the fit can be anything.
  댓글 수: 2
Matt J
Matt J 2015년 1월 19일
The location of the extrema determine everything about a sine curve: frequency, amplitude, and phase. There's nothing left to fit.
curoi
curoi 2015년 1월 22일
편집: curoi 2015년 1월 22일
You're absolutely right. I didn't explain that I didn't mean a single sine term but multiple sine terms. Is there a way to hold the summation of the terms fixed at certain points?

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2015년 1월 22일
편집: Matt J 2015년 1월 22일
If the unknown curve is given by y=F(x,p) where p is the vector of unknown parameters, and x and y are vectors of curve samples, then fmincon could be used to estimate p, with a sufficiently good initial guess p0,
p_fit = fmincon(@(p) norm(F(xdata,p) - ydata)^2, p0, [],[],[],[],[],[],...
@(p) F(xfixed,p)-yfixed, options)
where xfixed and yfixed are the x,y pairs that you want constrained. Then, of course, you get the curve with
y_fit=F(xdata,p_fit);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by