place matrix in array part 2

5 views (last 30 days)
monkey_matlab
monkey_matlab on 15 Oct 2016
Answered: Marc Jakobi on 15 Oct 2016
This post is building from the post found here.
Hello, I have these points:
x1 = (1,0), x2 = (0.5,1), x3 = (0.5,1.5), x4 = (0, -1), x5 = (-1,1), x6 = (0.5, -1)
y1 = y2 = y3 = 1 and y4 = y5 = y6 = -1.
How do I go about generating a 6 x 6 matrix with entries
y1y1x1'x1 y1y2x1'x2 y1y3x1'x3 y1y4x1'x4 y1y5x1'x5 y1y6x1'x6
y2y1x1'x1 y2y2x2'x2 y2y3x2'x3 y2y4x2'x4 y2y5x2'x5 y2y6x2'x6
y3y1x3'x1 y3y2x3'x2 y3y3x3'x3 y3y4x3'x4 y3y5x3'x5 y3y6x3'x6
y4y1x4'x1 y4y2x4'x2 y4y3x4'x3 y4y4x4'x4 y4y5x4'x5 y4y6x4'x6
y5y1x5'x1 y5y2x5'x2 y5y3x5'x3 y5y4x5'x4 y5y5x5'x5 y5y6x5'x6
y6y1x6'x1 y6y2x6'x2 y6y3x6'x3 y6y4x6'x4 y6y5x6'x5 y6y6x6'x6

Accepted Answer

Marc Jakobi
Marc Jakobi on 15 Oct 2016
Well if
y = [ones(3,1); -ones(3,1)]
% or
y = [1;
1;
1;
-1;
-1;
-1];
and x is taken from your previous question, then your result would be.
res = y * y' .* x * x';
This is very basic matrix multiplication. I suggest you read through some tutorials

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!