1
vote
3answers
38 views

How to multiply a matrix by a scalar value in MATLAB under a condition

In matlab I have a matrix with random numbers between 0 and 100. All numbers below 10 shall be multiplicated by two. testmatrix = [1,2;11,90] should turn into [2,4;11,90] Executing conditional ...
2
votes
2answers
61 views

Take the product of all nonzero elements in each column of a sparse matrix

Is there a well-vectorized way to take the product of all the nonzero elements in each column of a sparse matrix in octave (or matlab) (returning a row-vector of products)?
0
votes
2answers
75 views

matlab vector addition like multiplication, without for loop

Normally when one adds two vectors this is what happens [1 4] + [2 5] = [3 9] I want it to do this: [1 4] + [2 5] = 3 6 6 9 So basically addition like how multiplication ...
-4
votes
1answer
77 views

matrix column multiplication

i have a matrix NV but now i want to multiply only the 2nd column by 2 how should i go about doing this? this is my current code: NV=zeros(10,10); g1= 1:1:10; n=2; for b=1:n NV(:,b)=10.^(g1/10); ...
3
votes
2answers
629 views

opencv - image multiplication

hi, i'm trying to play a little bit with Mat class. I want to do a product element wise between two images, the c++/opencv port of MATLAB immultiply. This is my code: #include ...
5
votes
2answers
146 views

3d matrix by column vector multiplication

I have a 3d (or in general n-dimensional) matrix A with dimensions size(A) = [d1 d2 d3 ... dn]. Now I want to do a vector multiplication with a column vector v over one of the dimensions (as I ...
2
votes
3answers
136 views

Matlab matrix row to row multiplacation of two matrix dimensions not agree

I have two matrix A and B for example A = [ 1 2 3; 5 4 3; ...] and B = [ 1; 2; 3; 4; 5; 6] (row matrix) and I want to have this A*B = [1*1 2*1 3*1; 5*2 4*2 3*2; ...] without a loop. Is it ...
2
votes
3answers
349 views

Multiplying Cell with elements of a matrix Matlab

I have a 1xm cell array A{}, with each element of the array being NxN matrix and a matrix W(N1,m). I need to calculate Sum(j) = W(j,1)*A{1,1} + W(j,2)*A{1,2} and I am doing the following: for ...
1
vote
2answers
94 views

Warning: “Parethesize the multiplication of 'D' and its transpose to ensure the result is Hermetian.”

As you see in the screen shot above, I have the following expression in my Matlab m-file code: K = P * D * D' * P; Where, P is an nxn matrix, and D is a nx1 column vector (n=4, if it matters). Why ...
2
votes
1answer
75 views

Creating a new probabilistic matrix from two existing ones according to prespecified rules in MATLAB

I have a problem in my MATLAB code. Let me first give you some explanation about the issue. I have two matrices which represent probabilities of specific outcomes of events. The first one is called ...
2
votes
2answers
583 views

Matlab: Multiplying select rows every nth interval

I have a 63row x 7column matrix. xmax=63; ymax=7; for i=1:xmax for j=1:ymax n=(i-1)*ymax+j; matrix(i,j)=n; end end 1 2 3 4 5 6 7 8 9 ...
1
vote
2answers
227 views

Multiplication of Vectors with diagonal of a matrices from t to t+1 in Matlab

Still very new to programming... I have 9x1 Vectors at time t, t+1, t+2 etc. [10 10 10 10 10 10 10 10 10]' and matrices. Each matrix is 9x9 and also at time 1, t+1, t+2 etc. = 1 0 0 ...