- #1
- 590
- 0
i am using MATLAB 2008a, for the course i am doing i have been asked to make a random matrix A, 5x5 with a maximum possible value of 10 and a minimum of -10, so what i would have usually done is
but i have been told to use the randn command, the problem is that the randn command doesn't have a maximum value of 1, and i cannot find its maximum possible value. what i have done is made the matrix and added a condition that
if A(i,j)>10, A(i,j)=10 and the same for -10, but there must be a better way.
Code:
A=-10+20*rand(5)
but i have been told to use the randn command, the problem is that the randn command doesn't have a maximum value of 1, and i cannot find its maximum possible value. what i have done is made the matrix and added a condition that
if A(i,j)>10, A(i,j)=10 and the same for -10, but there must be a better way.