I have 4 matrices: X1=[1;2;3;4] X2=[ 5,6,7,8] X3=[9,10,11,12] X4=[13,14,15,16]
I would like to compare these matrices to each other and i want to create a new matrix depending on this comparison.
So I want to create a Y=[yij] 4x4 matrix which consists of matrices.
Now i'll explain the comparing rule with an example.
Here min(X1)= 1 and the max(X1)=4
Let's take x ∈ X2.
If x satisfy min(X1) <= x <= max(X1) it should be 1 in a new matrix , if it does not satisfy min(X1)<= x <= max(X1) it should be 0 in a new matrix.
So in this example i need a matrix :[ 0; 0; 0; 0 ]
According to this rule, i want to create a matrix Y=[yij] which consist of these comparison matrices.
So the first row of Y should consist of 4 elements in other words 4 different matrices related to X1. ( comparison of X1 with itself and others )
- First element of this matrix is y11 which consists of comparing X1 with itself. ( y11= [1;1;1;1], since every element satisfies the rule)
- Second element is y12 which consists of comparing X1 with X2. (y12=[0;0;0;0], since none of the elements satisfies the rule)
- Third element is y13 which consists of comparing X1 with X3.
- Last element of the first row is y14 which consists of comparing X1 with X4.
In this way, i want to create a 4x4 matrix Y.
Is there any way to do this with for loop?