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?

回答 (1 件)

Star Strider
Star Strider 2017 年 9 月 1 日

0 投票

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.

カテゴリ

ヘルプ センター および File ExchangeInterpolation についてさらに検索

質問済み:

2017 年 9 月 1 日

回答済み:

2017 年 9 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by