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

1 回表示 (過去 30 日間)
M
M 2022 年 5 月 20 日
コメント済み: M 2022 年 5 月 20 日
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.
M
M 2022 年 5 月 20 日
@KSSV, I have another saved Matrix M.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by