How to perform the following operation ( M(:,c)=M(:​,c)+thr*M(​:,c).*(N*2​-1); )in each column in matrix M?

조회 수: 1 (최근 30일)
How to perform the following operation ( M=M+thr*M.*(N*2-1);)in each column in matrix M?
M is matrix with size 14*128
N is random matrix with size 14*1
I tried the follwing code but it doesnt work.. Does any one has any idea how to run this?
thr=.05 ;
N=rand(14,1) ;
for c=1:128
M(:,c)=M(:,c)+thr*M(:,c).*(N*2-1);
end

채택된 답변

KSSV
KSSV 2022년 5월 20일
thr=.05 ;
M = rand(14,128) ;
N = rand(14,1) ;
for c=1:128
M(:,c) = M(:,c)+thr*M(:,c).*(N*2-1);
end
  댓글 수: 3
KSSV
KSSV 2022년 5월 20일
It didn't work in your case because, you have not defined the matrix M.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by