function [Q, R] = updateQR(Q, R, B_new) % Updates the QR decomposition with a new batch of sensor readings % Inputs: % Q, R - Current QR decomposition matrices. % B_new - New batch of sensor readings (m x n) % Outputs: % Q, R - Updated QR decomposition matrices m = size(Q,1); n = size(R,2); k = size(B_new,1); [QB, RB] = qr(B_new); [Q_new, R] = qr([R; RB]); Q = [Q, zeros(m,k);zeros(k,m), QB] * Q_new; end