Linear Combination Analysis help

I have a spectrum (Stot) that's a linear combination of two known spectra (Sa and Sb). I would like to fit Stot , Stot = kSa + (1-k)Sb, and extract k and 1-k for Sa and Sb respectively from this fit. I have the Stot spectrum at a series of times, can I fit multiple spectra at one time?

Respuestas (1)

Star Strider
Star Strider el 1 de Sept. de 2017
One possibility:
k = 4.2; % Define ‘k’
t = linspace(1, 4*pi);
Sa = sin(t); % Create ‘spectra’
Sb = cos(t); % Create ‘spectra’
Stot = k*Sa + (1 - k)*Sb;
f = @(k) norm(Stot - (k*Sa + (1-k)*Sb)); % Cost Function: Nonlinear Approach
K = fminsearch(f, 2) % Estimate ‘k’: Nonlinear Approach
K = [Sa(:) Sb(:)]\Stot(:) % Estimate ‘k’: Linear Approach
However without your data I cannot claim that either of these will work reliably with it. Experiment to get the result you want.

Categorías

Preguntada:

el 1 de Sept. de 2017

Respondida:

el 1 de Sept. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by