When do I need element wise operators?
I Want to perform element wise matrix multiplication
Element wise multiplication by a vector
performance - Fastest way to do repeated element wise matrix multiplication in MATLAB? - Stack Overflow
Hi guys,
I am trying to implement this function in Matlab: https://imgur.com/a/iM3PepF.
The solution I've been provided with by my teacher is the following: https://imgur.com/a/iM3PepF.
X and Y are vectors.
My question now is: Why do I need for the first operator an element wise operator (.*) but not also for the second and third operator? This is really confusing me.
Thanks for your help!
You could do something like this, Which seems to be what you want and provides the same results as what you post.
A = [2 3;
4 5];
B = [9 8 7 6;
8 7 6 5];
A = imresize(A,size(B),'nearest');
C = A.*B
This will only really work in the particular case you are presenting though. It also assumes you have the image processing toolbox
You can permute, reshape, multiply element-wise, permute again and reshape back:
X = bsxfun(@times, A, reshape(B.', size(A,1), size(A,2), [])); %'// elementwise
C = reshape(permute(X, [1 3 2]), size(B));