Code covered by the BSD License
-
key=KeyPressTestFunction
Attaches KeyPress test function to the figure
-
(2.*n)./(1+n);
-
4*exp(-e).*(1-exp(-e));
g(1:r...
-
ExpBroaden(g',timeconstant);
-
ExpBroaden(y,t)
ExpBroaden(y,t) convolutes y by an exponential decay of time constant t
-
FitResults=FitAndPlot(xx,yy,N...
Given isolated segment of signal (xx,yy), plots it in upper half, computes fit with
-
[xx,yy,start]=RedrawSignal(x,...
Plots the entire signal (x,y) in the lower half of the plot window and an
-
exp(-((x-pos)./(0.6006.*wid))...
-
exp(-(log(x/pos)/(0.01.*wid))...
-
ipf(x,y)
Interactive Peak Fitter function.
-
ipf10down
Pans down 10 points and redraws graph
-
ipf10up
Pans up 10 points and redraws graph
-
ipfbackground(n,h)
Allows user to click graph to enter background points,
-
ipfcustom(n,h)
Allows user to click graph to enter start positons,
-
ipfextra(n,h)
-
ipfnudgedown
Pans down one point and redraws graph
-
ipfnudgeup
Pans up one point and redraws graph
-
ipfpan(n,h)
Re-draws graph and updates "start" when the Pan slider is moved
-
ipfpeaks(n,h)
Updates "NumPeaks" and re-draws graph when the # Peaks slider is moved
-
ipfpeaksmouseup
Computes fit on a mouseup in the # Peaks slider
-
ipfrefit(n,h)
Computes fit and re-draws graph when the Re-fit slider is moved
-
ipfshape(n,h)
Redraws signal when the shape slider is moved
-
ipfzoom(n,h)
Updates "start" and re-draws graph when the Zoom slider is moved
-
ipfzoom10down
ZOOMS DOWN 10 points and redraws graph
-
ipfzoom10up
ZOOMS UP 10 points and redraws graph
-
ipfzoomdown
ZOOMS DOWN one point and redraws graph
-
ipfzoomup
ZOOMS UP one point and redraws graph
-
lorentzian(x,position,width)
...
-
norm(z-y');
-
norm(z-y');
-
norm(z-y');
-
norm(z-y');
-
norm(z-y');
-
norm(z-y');
-
norm(z-y');
-
norm(z-y');
-
pearson7(x,pos,wid,m) where x...
-
rtslid(fig,f,hh,varargin)
RTSLID Slider widget that responds to dragging realtime
-
shape number. When this numb...
-
DemoInteractivePeakFitter.m
-
InteractivePeakFitter.m
-
View all files
from
Interactive Peak Fitter, version 2.2
by Tom O'Haver
A peak fitting program for time-series signals.
|
| DemoInteractivePeakFitter.m |
% Demonstration of Interactive Peak Fitter with built-in signal generator.
% You can change the character of the signal in lines 25-31.
% T. C. O'Haver http://www.wam.umd.edu/~toh/spectrum/InteractivePeakFitter.htm
% Version 2.2, May 2008, adds peak area to FitResults (in FitAndPlot.m)
clear
global x
global y
global xo
global dx
global NumPeaks
global Shape
global Scan
global Width
global c
global FitResults
global start
global extra
close
format compact
warning off all
warning('OFF', 'Exiting:')
% Generate simulated signal
n=2000; % maximum x-value
increment=2; % Difference between adjacent x values
x=[1:increment:n];
amp=[1 2 3 1 4 1 3 2 1 2 1]; % Amplitudes of the peaks (one entry for each peak)
pos=[100 130 200 400 600 630 800 850 900 1200 1700]; % Positions of the peaks (one entry for each peak)
wid=[30 40 50 30 20 20 30 40 50 100 200]; % Widths of the peaks (one entry for each peak)
noise=.01;
% A = matrix containing one of the unit-amplidude functions in each of its rows
clear A
A=zeros(length(pos),length(x));
for k=1:length(pos),
A(k,:)=gaussian(x,pos(k),wid(k)); % Can be any peak function
end
TrueY=amp*A; % Multiplies each row by the corresponding amplitude and adds them up
% TrueY=TrueY+lorentzian(x,0,1000); % Adds background
y = TrueY + noise .* randn(size(x));
% Arrange the peak parameters of the simulated signal into a matrix
ColumnLabels=' Peak# Position Height Width';
NumPeaks=length(pos);
for m=1:NumPeaks,
if m==1,
ActualParameters=[m pos(m) amp(m) wid(m)];,
else
ActualParameters=[ActualParameters; [m pos(m) amp(m) wid(m)]];
end
end
% Display the peak parameters of the simulated signal
ColumnLabels
ActualParameters
% Execute the Interactive Peak Fitter script
InteractivePeakFitter;
|
|
Contact us at files@mathworks.com