Effacer les filtres
Effacer les filtres

How can I multiply a row vector with each of two column vectors?

3 vues (au cours des 30 derniers jours)
wd w
wd w le 19 Fév 2024
Commenté : wd w le 19 Fév 2024
I have a row vector and two column vectors, and intend to perform their multiplication (element by element). The following is an example.
t = [1 2];
s = [(1:3)',(4:6)'];
The expected result:
1 2 4 8
2 4 5 10
3 6 6 12

Réponse acceptée

Dyuman Joshi
Dyuman Joshi le 19 Fév 2024
t = [1 2];
s = [(1:3)',(4:6)'];
out = kron(s,t)
ans = 3x4
1 2 4 8 2 4 5 10 3 6 6 12

Plus de réponses (0)

Catégories

En savoir plus sur NaNs dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by