gaussian distribution and matrix
27 views (last 30 days)
Show older comments
hi! I have a matrix with components of modulus 1 and phase different each other. how can I add a gaussian component on each element? thank you. the result that I want is a matrix with Rice factor. thank you in advance.
0 Comments
Answers (1)
Gautham Sholingar
on 20 Sep 2016
Hello Francesco,
I am assuming that you want to create a matrix of random numbers with a Gaussian distribution and then multiply each element in your original matrix with this random number matrix in an element-wise fashion.
>> inputData = rand(5,5)
The following command creates a normal distribution with zero mean and unit standard deviation of the same size as your inputData matrix
>> gaussMatrix = random('normal',0,1,size(inputData))
gaussMatrix =
-2.4557 0.5294 0.3643 -0.3102 -0.2547
-0.0911 -2.2171 -0.7637 -0.6199 -0.5477
-0.0247 0.1074 0.5495 -1.0246 1.6766
0.1999 0.4389 -0.3746 0.5050 1.1730
-1.0383 -0.0410 -1.6592 0.0405 -0.1891
Then you can use the .* operator to perform elementwise multiplication|
>> result = inputData.*gaussMatrix
result =
-0.6985 0.2113 0.1796 -0.0686 -0.0498
-0.0670 -0.1158 -0.1693 -0.0595 -0.4903
-0.0102 0.0614 0.5162 -0.0616 1.1473
0.1657 0.3282 -0.1807 0.4139 0.7705
-0.9709 -0.0131 -0.8959 0.0312 -0.1872
If your query is related to the use of any other types of data distribution, please refer to the following MATLAB documentation:
0 Comments
See Also
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!