matlab LSQ error calculation computation time

1 次查看(过去 30 天)
Hi everybody,
I am trying to calculate a simple least squares solution and its corresponding error with the function below. When calculating the error the script slows down significantly. In fact a run with an active profiler shows that 99% of computation time is spent in the line
err=psi'*(I-H*t)*psi.
Can anybody explain why this line is so expensive or give an solution that is faster?
%H: observation matrix,
%I: identiy matrix,
%psi: measurement vector,
%PCO: parameter estimate,
%err: error of the estimate
function [PCO,err]=calcPC_LSQ(H,I,psi)
t=(H'*H)\H';
PCO=t*psi;
err=psi'*(I-H*t)*psi;
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by