help on fitting a curve

Asked by Leah on 10 Jul 2012
Latest activity Commented on by Wayne King on 11 Jul 2012

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?

0 Comments

Leah

Products

No products are associated with this question.

1 Answer

Answer by Wayne King on 10 Jul 2012
Edited by Wayne King on 10 Jul 2012

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 Comments

Leah on 10 Jul 2012

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 on 11 Jul 2012

Do you mean datatype double-precision? why not, the example I have above uses double-precision vectors.

Wayne King

Contact us