필터 지우기
필터 지우기

Summing squared elements of a column of a matrix

조회 수: 24 (최근 30일)
kevin cecere palazzo
kevin cecere palazzo 2019년 8월 6일
답변: Star Strider 2019년 8월 6일
for i=1:N
s(i)=sum(V(:,2))/sqrt(n);
t(i)=sum(V(:,2))/sqrt(sum((V(:,i).*V(:,i)));
end
Both s and t are Nx1 vectors, while V is a nxN matrix. In s I summed the elements of each column of V for every element of s. How can I divide, in t, by the square root of the sum of the SQUARED elements of each column of V?

답변 (1개)

Star Strider
Star Strider 2019년 8월 6일
It’s not clear what you want to do.
Try this:
V = rand(6,5); % Guess What ‘V’ Is
n = size(V,1);
N = size(V,2);
s = sum(V)/sqrt(n); % Sum Over Columns, Divide By ‘sqrt(n)’
t = sum(V)./sqrt(sum(V.^2,2)); % Sum Over Columns, Divide By ‘sum(sqrt(Rows))’

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by