user123
user123

Reputation: 33

random matrices 2

I would like to generate 100 random square 6x6 matrices A=[a_{ij}] with Gaussian noise (modification with standard deviation 0.5) satisfying the following characteristics:

 1. multiplicative inverse: i.e., a_{ij}=1/a_{ji} for all i,j=1,2,...,6.
 2. all entries are positive: i.e., a_{ij}>0 for all i,j=1,2,...,6.
 3. all diagonal elements are 1: i.e, a_{ii}=1 for all i=1,2,..,6.
 4. transitive: i.e., a_{ih}*a_{hj}=a_{ij} for all i,j,h=1,2,...,6.

So far, I tried to use a matlab function randn(6)*0.5. But, I got wrong matrices. I was wondering if anyone could help me?

Here is my matlab code:

clc;clear;
n=6;
m=0;
A=randn(n)*0.5; % random matrix with guassian noise
for i=1:n
    for j=1:n
     for h=1:n
         while m<100  % generate 100 random matrices
             m=m+1;
             A=randn(n)*0.5;   % random matrix with guassian noise \sigma=0.5

             A(i,j)>0
                A(i,j)==1/A(j,i);
                A(i,h)*A(h,j)==A(i,j)
             if i==j && j==h
                 A(i,j)==1;
             end
         end
     end
    end
end
 A       

Upvotes: 0

Views: 81

Answers (1)

Daniel
Daniel

Reputation: 36710

This is primarily a math question, not a programming question. First you have to look at the constraints and solve them. I ended up with:

[  1,  1/X2,  1/X3,  1/X4,  1/X5]
[ X2,     1, X2/X3, X2/X4, X2/X5]
[ X3, X3/X2,     1, X3/X4, X3/X5]
[ X4, X4/X2, X4/X3,     1, X4/X5]
[ X5, X5/X2, X5/X3, X5/X4,     1]

This means you have to randomly choose X2,X3,X4,X5, from there all other values. Here I face a challenge I can not solve. When I choose a standard deviation of 0.5 for those variables, the calculated variables will have a higher standard deviation.

Upvotes: 1

Related Questions