Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Making a square matrix from two vector
Replies: 22   Last Post: Mar 19, 2013 12:37 AM

 Messages: [ Previous | Next ]
 Bruno Luong Posts: 9,822 Registered: 7/26/08
Re: Making a square matrix from two vector
Posted: Feb 9, 2013 3:24 AM

To have a cleaner code than BSXFUN, one can use
http://www.mathworks.com/matlabcentral/fileexchange/23821-bsxops

>> bsxops(1)
>> % Data

a = [1 2 3 4];
b = [1 2 4 5].';
>> x = b.*a + a + b

ans =

3 5 7 9
5 8 11 14
9 14 19 24
11 17 23 29

% Bruno

Date Subject Author
2/8/13 Jerry
2/8/13 Barry Shaw
2/8/13 dpb
2/8/13 james bejon
2/9/13 Bruno Luong
2/9/13 james bejon
2/9/13 Bruno Luong
2/12/13 james bejon
2/12/13 Steven Lord
2/12/13 Bruno Luong
2/12/13 dpb
2/12/13 Bruno Luong
2/12/13 dpb
2/13/13 Bruno Luong
2/13/13 dpb
2/14/13 Bruno Luong
2/14/13 dpb
2/14/13 Bruno Luong
2/14/13 dpb
2/14/13 dpb
2/13/13 james bejon
3/18/13 James
3/19/13 Bruno Luong