How to make operator for random matrix(matlab command is randn) ? please help me

 Accepted Answer

If you want to create normally-distributed random variables with a standard deviation of s and a mean of m with randn, this will work:
nrmrnd = @(m,s) m + s*randn;
or if you want a row r by column c matrix of them:
nrmrnd = @(m,s,r,c) m + s*randn(r,c);

4 Comments

sir, actually i have a signal x of dimension n. Now we have to make a random matrix operator such that when we multiply this operator with the signal x then we have to get the result of multiplication randn(n,n)*x.
If as I assume x is a (1xn) column vector, then your multiplication is simply:
r = randn(length(x))*x;
The result, r will be a (1xn) column vector.
sir,this is not an operator. In your first comment you give the operator.I need that type of operator. Please help....
This function should work:
xrndn = @(x) randn(length(x))*x(:);
Call it as:
y = xrndn(x);
for any vector x.

Sign in to comment.

More Answers (0)

Categories

Find more on Random Number Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!