help on fitting a curve

2 次查看(过去 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 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by