residual r=ax-b ∞-norm

조회 수: 78 (최근 30일)
dulanga
dulanga 2019년 3월 18일
댓글: dulanga 2019년 3월 19일
This is my code but i dont get the coorect answer
a = [-5 8 -5; 0 0 12; 3 -7 -3;6 -4 4]
b = [1;1;1;1]
x=a\b
r=a*x-b
x1=sqrt(sum(r.*r))
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 3월 19일
what is the definition of infinity norm?

댓글을 달려면 로그인하십시오.

채택된 답변

dulanga
dulanga 2019년 3월 19일
Would this be correct to get infinty norm
a = [-5 8 -5; 0 0 12; 3 -7 -3;6 -4 4]
b = [1;1;1;1]
x=a\b
r=a*x-b
N = norm(r, Inf)
  댓글 수: 4
John D'Errico
John D'Errico 2019년 3월 19일
That is correct, as long as you are allowed to use the norm function. Things like that are sometimes not allowed in homework. If not, then you need to do as I suggested, as
max(abs( r ))
dulanga
dulanga 2019년 3월 19일
noted

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

John D'Errico
John D'Errico 2019년 3월 19일
Why would you possibly have expected to get the right answer? Was the infinity norm requested? Is it a 2-norm that you computed?
x1=sqrt(sum(r.*r))
If r is the vector of residuals, then what do you want to compute? It seems like you want the maximum of the absolute value of the residuals. How would you do that?

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by