Divide vectors of different lengths?
3 views (last 30 days)
Show older comments
Hi,
I have two vectors of different lengths where one vector A is a 2x1 matrix and vector B is a 1x491 matrix. I want to divide each element in A by the vector B so that I get C and it will be a 2x491 matrix. I am not sure on how to execute this so can anyone please advise?
I want it to look something like this: A=[a1 a2]', B=[b1,...,b491], C=A/B where C=[a1/b1,...,a1/b491 ; a2/b1,...,a2/b491]
0 Comments
Accepted Answer
Azzi Abdelmalek
on 7 Mar 2014
Edited: Azzi Abdelmalek
on 7 Mar 2014
a=[1 2]
b=[1 2 3 4]
out=bsxfun(@rdivide,a.',b)
0 Comments
More Answers (0)
See Also
Categories
Find more on Particle Swarm 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!