Multiply Matrix with column of different sizes

1 view (last 30 days)
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.

Image Analyst
Image Analyst on 13 Jul 2013
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.

Azzi Abdelmalek
Azzi Abdelmalek on 13 Jul 2013
%Example
A1=rand(240,1)
A2=rand(300,1)
%----The code--------
n=240;
out=A2;
out(1:n)=A1.*A2(1:n)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!