How do I multiply vector elements in the following fashion???
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Maruti Patil
am 2 Apr. 2016
Kommentiert: Maruti Patil
am 2 Apr. 2016
Suppose I have A=[18 44 20 55] & B=[4 6]
Now I want C=[18*4 44*4 20*6 55*6]
i.e I want to multiply first element of B with first pair of elements in A
and second element of B with second pair of A and so on...
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 2 Apr. 2016
Bearbeitet: Azzi Abdelmalek
am 2 Apr. 2016
A=[18 44 20 55]
B=[4 6]
out=reshape(bsxfun(@times,A',B),1,[])
3 Kommentare
Azzi Abdelmalek
am 2 Apr. 2016
Then you have to reshape A
reshape(bsxfun(@times,reshape(A,2,2),B),1,[])
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!