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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

KSSV
KSSV il 20 Mag 2022
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 Commenti

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by