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
2017-9-1
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 Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!