help on fitting a curve

조회 수: 5 (최근 30일)
Leah
Leah 2012년 7월 10일
how do you fit data with a peak using a Gaussian curve? If there are two peaks but you only want to fit a curve within a specific range asked by the user, how do you fit a curve?

답변 (1개)

Wayne King
Wayne King 2012년 7월 10일
편집: Wayne King 2012년 7월 10일
Do you have the curve fitting toolbox?
If so, cftool has a Gaussian option built in.
Or from the command line:
x = (-3:0.01:3)';
y = exp(-x.^2/2);
yfit = fit(x,y,'gauss1');
  댓글 수: 2
Leah
Leah 2012년 7월 10일
what happens if i have a dimention of double for the x and double for the y, doing that doesn't work is there any other way?
Wayne King
Wayne King 2012년 7월 11일
Do you mean datatype double-precision? why not, the example I have above uses double-precision vectors.

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

카테고리

Help CenterFile Exchange에서 Multivariate Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by