2x2 Projection matrix of rank 1
6 次查看(过去 30 天)
显示 更早的评论
2 个评论
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.
采纳的回答
Matt J
2022-11-23
编辑:Matt J
2022-11-23
a=[1; 2]; n=[3; 4]; x=[5; 6];
r1p(a,n,a)
r1p(a,n,n)
r1p(a,n,x)
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 个评论
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
2022-11-24
%should work for:
a=[1; 0.01]
n=[0.01; 1]
x=[1; 0]
p=r1p(a,n,x)
%and for:
a=[1; 0];
n=[0; 1];
x=[1; 0];
p = r1p(a,n,x);
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
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 Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!