Как я использую приближение наименьших квадратов в MATLAB?

Несколько человек дали версии этого:

right('XXXXXXXXXXXX'+ @str, @n)

быть осторожным с этим, потому что это усечет Ваши фактические данные, если это будет более длинно, чем n.

5
задан Jakob 2 December 2009 в 11:47
поделиться

2 ответа

mldivide, ("\") actually does that too. According to the documentation:

If A is an m-by-n matrix with m ~= n and B is a column vector with m components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations AX = B. In other words, X minimizes norm(A*X - B), the length of the vector AX - B. The rank k of A is determined from the QR decomposition with column pivoting (see Algorithm for details). The computed solution X has at most k nonzero elements per column. If k < n, this is usually not the same solution as x = pinv(A)*B, which returns a least squares solution.

So really, what you did in the first assignment was to solve the equation using LSE.

6
ответ дан 14 December 2019 в 04:40
поделиться

Включает ли ваше задание явное кодирование аппроксимации наименьших квадратов или просто использование другой функции, доступной в MATLAB? Если вы можете использовать другую функцию, один из вариантов - LSQR :

x = lsqr(A,y);
2
ответ дан 14 December 2019 в 04:40
поделиться
Другие вопросы по тегам:

Похожие вопросы: