how to take vector and norm for indiviual column in the complex matrix

조회 수: 2 (최근 30일)
p=inf;
for k=1:k
gk =G(:,k);
N =norm(gk,p);
vk=gk/N;
end

채택된 답변

Andrei Bobrov
Andrei Bobrov 2018년 1월 30일
편집: Andrei Bobrov 2018년 1월 30일
vk = G;
for k=1:size(vk,2)
vk(:,k) =G(:,k)/norm(G(:,k),inf);
end
  댓글 수: 1
VISHALI V
VISHALI V 2018년 1월 30일
what value can i use for p ? if i check this code in matlab it shown values of all column are equal how should i see the indiviual column value?

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

추가 답변 (1개)

Torsten
Torsten 2018년 1월 30일
편집: Torsten 2018년 1월 30일
1) "for k=1:k" won't work ; you will have to use another variable name for the upper bound of the Loop.
2) You permanently overwrite the vectors vk in the loop. Adding the line Gnorm(:,k)=vk should work.
p=Inf;
for k=1:size(G,2)
gk =G(:,k);
N =norm(gk,p);
vk=gk/N;
Gnorm(:,k)=vk;
end
Best wishes
Torsten.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by