makespec

Construct spectrum from peak positions and amplitudes.

Syntax
spec = makespec(Range,nPoints,Pos)
spec = makespec(Range,nPoints,Pos,Amp)
[x,spec] = makespec(...)
Description

makespec collects the peaks with positions listed in Pos and amplitudes listed in Amp into a spectral vector spec. The 2-element array Range = [minX maxX] specifies the range of the abscissa, and nPoints gives the number of points. If requested, the abscissa is returned in x.

If Amp is not given, all amplitudes are set to 1.

Peaks that fall outside the specified range are neglected.

Examples

A simple demonstration bins a number of peaks with random positions and amplitudes into a spectral vector.

N = 20;
pos = rand(1,N);
amp = rand(1,N);
[x,s] = makespec([-0.2,0.7],2000,pos,amp);
plot(x,s)
See also

convspec