How to manipulate 2 matrices and form a third matrix

I have the following vectors:
a = [1 2]; b = [0.25 0.5];
i aim to get the following 2 x2 matrix
% c = [1/0.25+1/0.5 2/0.25+1/0.5
% 1/0.25+2/0.5 2/0.25+2/0.5]
does anyone have an idea how i would achieve this?
thanks

Answers (2)

a = [1 2];
b = [0.25 0.5];
for k=1:2
for p=1:2
c(k,p)=a(k)/b(1)+a(p)/b(2)
end
end

1 Comment

hi position 11 of the output matrix gives a value of 4.2 however doing the calculation manually [1/0.25+1/0.5 = 6 just wondering why this is

Sign in to comment.

a = [1 2];
b = [0.25 0.5];
d = [a; a];
c = d / b(1) + d' / b(2);

Categories

Asked:

AI
on 17 Apr 2013

Community Treasure Hunt

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

Start Hunting!