Multiply Matrix with column of different sizes

how to multiply matrices with columns of different size. Example: Matrix A = (A1, A2) with dim A1 = 240x1 dual and A2 = 300x1 Double.

Answers (3)

Matt J
Matt J on 13 Jul 2013
Edited: Matt J on 13 Jul 2013
Do you mean an outer product?
A=A1(:)*A2(:).';
Otherwise, show a (small) example with input data and the desired output.
What are you going to multiply by A? I know what double is, but what data type is "dual"? Why do you want to multiply two matrices together when that doesn't follow the normal rules of matrix multiplication as far as the number of columns of the left matrix matching the number of rows in the second matrix? Maybe you should call interp2() or imresize() to resize one of the matrices before multiplication.
%Example
A1=rand(240,1)
A2=rand(300,1)
%----The code--------
n=240;
out=A2;
out(1:n)=A1.*A2(1:n)

Categories

Asked:

on 13 Jul 2013

Community Treasure Hunt

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

Start Hunting!