How to perform elementwise multiplication between two matrices with different size or summation between two matrices with the same size
Afficher commentaires plus anciens
Hello, imagine I have the following array:
f = 1:10;
x = -22:1:22;
y = -22:1:22;
[u,v] = meshgrid(x,y);
I wish to perform elementwise multiplication operation between 'f' and 'u' (I mean the final array must have numel(f)*numel(u) elements.) . How can I fo this efficiently (definitely I know how to do this using "for loop". this is time consuming.)? Moreover, Imagine that I want to sum "u" and "v" elementwisely which both of them have the same size (so the final array must have numel(u)*numel(v) elements.) . How to do this in order to have high speed?
Réponse acceptée
Plus de réponses (1)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!