Gaussian fit of a peak
Ben Abbott
bpabbott at mac.com
Wed Sep 17 17:55:45 CDT 2008
On Sep 17, 2008, at 4:58 PM, Andrea Cimatoribus wrote:
> In matlab, I used function "fit". Data are intensity as a function of
> energy. Of course, you can think it as an histogram of event number as
> a function of energy.
> Andrea
>
> 2008/9/17 Ben Abbott <bpabbott at mac.com>:
>>
>>
>> On Wednesday, September 17, 2008, at 10:20AM, "Andrea Cimatoribus" <sambarluc at gmail.com
>> > wrote:
>>> Hi everybody,
>>> I am an absolute novice of octave, even though I have some
>>> experience
>>> with matlab.
>>> Just to get the feeling of octave, I am presently translating a
>>> simple
>>> (but very useful to me) script, that basically sums data with a peak
>>> structure. In order to do this properly, I need to centre each new
>>> spectrum on the zero, that is the peak maximum. My strategy, in
>>> matlab, was to make a preliminary gaussian fit, whose result was
>>> to be
>>> confirmed through a graphical input, to get the "zero" of the
>>> spectrum. As of now, I am trying to understand how can I make a
>>> gaussian fit of the data in octave. Data is simply organised as a
>>> matrix [x,y]. Is there a built function? Sorry but I can't find
>>> anything with online help.
>>> Andrea
>>
>> How did you do it in Matlab?
>>
>> If the data is statistical, then I'd recommend you calculate the
>> median and standard deviation and construct the gaussian
>> distribution from that.
>>
>> By "sums data with a peak structure" do you mean you are
>> constructing a histogram?
>>
"fit" is part of the curefit toolbox, correct?
In any event, there is a package available from MathWorks File
Exchange called "fit" I thought would work, but Octave's fminsearch
has some trouble with it. If you'd like to track down the specifics ...
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8468
You'll need Octave's optimization package
http://octave.sourceforge.net/doc/optimization.html
Ben
More information about the Help-octave
mailing list