资源简介
应用matlab实现的高等数理统计最小二乘估计源码
Matlab implementation of higher application of mathematical statistics source least squares estimation
代码片段和文件信息
%------begin computing the Least Square Estimate of intensity coefficients
frequency=[20;200;2000;20000];
timeIntvl=0:0.025:24.975;
timeIntvl=timeIntvl*(10^-3); % transform the ms unit of time into s unit
ctrlVarMatrix=sin(2*pi*(frequency*timeIntvl)); % compute the matrix of the control variables
fid=fopen(‘observationsOfSample.txt‘‘r‘);
obstnVector_Y=fscanf(fid‘%f‘); % read observations of sample from file
fclose(fid);
obstnVector_Y=obstnVector_Y*(10^-3); % transform the mV unit of voice into V unit
factorLSE1=ctrlVarMatrix*transpose(ctrlVarMatrix);
if(rank(factorLSE1) factorLSE2=inv(factorLSE1+eye(44)*(10^-7)); % modify the factorLSE1:add up factorLSE1 and a unit matrix that multiled by a tiny value
else
factorLSE2=inv(factorLSE1); % compute the generalized inverse matrix of factorLSE1
end
factorLSE=factorLSE2*ctrlVarMatrix*obstnVector_Y; % compute the Least Square Estimate of intensity coefficients
%------end computing the Least Square Estimate of intensity coefficients
%------begin computing the Least Square Estimate of variance
Qe=0;
for i=1:size(obstnVector_Y1)
Qe=Qe+(obstnVector_Y(i)-(transpose(ctrlVarMatrix(:i))*factorLSE))^2;
end
varianceLSE=Qe/(size(obstnVector_Y1)-size(frequency1)-1);
%------end computing the Least Square Estimate of variance
%------output the result of Least Square Estimate
disp([‘the LSE of factors from 1 to ‘num2str(size(factorLSE1))‘ as follow : ‘])
disp(vpa(factorLSE4))
disp(‘the LSE of variance as follow : ‘)
disp(vpa(varianceLSE4))
plot(timeIntvlobstnVector_Y)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1611 2008-12-21 19:58 LSETest.m
----------- --------- ---------- ----- ----
1611 1
- 上一篇:DCT系数直方图
- 下一篇:OFDM MATLAB源码
评论
共有 条评论