2x2 Projection matrix of rank 1

조회 수: 10 (최근 30일)
john
john 2022년 11월 23일
편집: john 2022년 11월 27일
  댓글 수: 2
Rik
Rik 2022년 11월 24일
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.
john
john 2022년 11월 27일
편집: john 2022년 11월 27일
oops

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

채택된 답변

Matt J
Matt J 2022년 11월 23일
편집: Matt J 2022년 11월 23일
a=[1; 2]; n=[3; 4]; x=[5; 6];
r1p(a,n,a)
ans = 2×1
0.1789 0.3578
r1p(a,n,n)
ans = 2×1
1.0e-15 * -0.1986 -0.3972
r1p(a,n,x)
ans = 2×1
-0.1789 -0.3578
function p = r1p(a,n,x)
% computes the action of P, the 2x2 projection matrix of rank 1 having
% a - the sole basis vector for the column space of P
% n - the sole basis vector for the null space of P
a = normalize(a(:),'n');
b = normalize(null(n(:)'),'n');
p = dot(x,b)*a;
end
  댓글 수: 4
john
john 2022년 11월 23일
Thank you so much for continuing to help me out. However, this now works for a=[1; 0.01]; n=[0.01; 1]; x=[1; 0]; (just have to negate it), but does not return the correct answer for a=[1; 2]; n=[3; 4]; x=[5; 6];
Matt J
Matt J 2022년 11월 23일
Again, you do not provide what you think is the correct answer, or an explanation of why that answer is correct..

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

추가 답변 (1개)

Moiez Qamar
Moiez Qamar 2022년 11월 24일
%should work for:
a=[1; 0.01]
a = 2×1
1.0000 0.0100
n=[0.01; 1]
n = 2×1
0.0100 1.0000
x=[1; 0]
x = 2×1
1 0
p=r1p(a,n,x)
P = 2×2
1.0001 -0.0100 0.0100 -0.0001
p = 2×1
1.0001 0.0100
p = 2×1
1.0001 0.0100
%and for:
a=[1; 0];
n=[0; 1];
x=[1; 0];
p = r1p(a,n,x);
P = 2×2
1 0 0 0
p = 2×1
1 0
function p = r1p(a,n,x)
% computes the action of P, the 2x2 projection matrix of rank 1 having
% a - the sole basis vector for the column space of P
% n - the sole basis vector for the null space of P
xi=[0 -1; 1 0]*n;
chi=xi/(xi'*a);
P=a*chi'
p=P*x
end
  댓글 수: 1
Matt J
Matt J 2022년 11월 24일
P=a*chi'
outer products are not efficient. That's why the exercise asks for you to compute p without computing P.

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

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by