How do you determine the slope and intercept of a linear trend by Gaussian distribution

3 views (last 30 days)
I used a desgin matrix approach to determine a linear trend to data that has background noise.
I need to find the slope and intercept of the Gaussian distribution
This is what I have done and I am not sure exactly how to interpret the results
code:
%Build design matrix
X=(2*pi*(60)*t);
A = [ones(length(t),1) exp(-((t-0.0001)/50).^2) sin(X)];
%SVD of the design matrix
[U,S,V]= svd(A,0);
W=diag(1./diag(S));
a= V*W*U'*y;
[n, m]= size(A);
redchisqu= sum((A*a-y).^2)/(n-m);
errmat= redchisqu*V*W.^2*V';
% display results:
disp(a)
sa = sqrt(diag(errmat));
disp(sa)
gaus_fit = a(1) + a(2)*exp(-(t-0.0001).^2/50.^2) + a(3)*sin(X);
figure
scatter(t,y,'o','filled')
set(gca,'FontSize',14,'box','on')
xlabel('Time [sec]')
ylabel('Volatile Compound Concentration Signal [arbitrary units]')
hold on
plot(t,gaus_fit,'Linewidth',3)
legend('Signal','Gaussian Peak')

Answers (0)

Categories

Find more on Fit Postprocessing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!