random matrices 2

不问归期 提交于 2020-01-25 07:28:09

问题


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       

回答1:


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.



来源:https://stackoverflow.com/questions/59596141/random-matrices-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!