"us " <us@neurol.unizh.ch> wrote in message <hnu72k$6th$1@fred.mathworks.com>...
> "alex " <av90@le.ac.uk> wrote in message <hnu64k$lin$1@fred.mathworks.com>...
> > hey
> >
> > i need to create a matrix that has three properties
> >
> > The matrix A of order n (to be decided by the user) should have the following properties:
> > 1) for i not= j the element in the ith row and jth column, written in matrix terms as A(i; j),
> > should have the value either 1 or 0
> >
> > 2) A(i; j) = A(j; i), i.e the matrix A is symmetric.
> >
> > 3) the diagonal element in the ith row and ith column, written in matrix terms as A(i; i),
> > should be such that the sum of the elements of any row should add up to zero.
> >
> > can anyone help?
>
> what have YOU done so far to solve YOUR homework(?)...
>
> us
hey us
well iv got this so far
n=input('Enter a positive integer');
m=input('Enter a positive scalar');
I=eye(n);
a=round(rand(1))
b=round(rand(1))
c=round(rand(1))
d=round(rand(1))
e=round(rand(1))
f=round(rand(1))
g=round(rand(1))
m1=(a+b+c)
m2=(a+d+e)
m3=(d+b+f)
m4=(a+b+c)
A=[m1 a b c ; a m2 d e ; b d m3 f ; c e f m4]
W=I+(m*A)
W=x1
for (k=1:10);
x1=W.*x1;
end
but this is purely for a 4 x 4 matrix i want to be able to create a similiar matrix but with any size of square matrix without typing this out an infinite amount of times, is there a special loop i can use that creates this random matrix?
