a=rand(400), this function generates 400*400 random matrix a,how could generate matrix a with specified mean and variance.

2 Ansichten (letzte 30 Tage)
a=rand(400), this function generates 400*400 random matrix a,how could generate matrix a with specified mean and variance in matlab.
  3 Kommentare
Image Analyst
Image Analyst am 24 Dez. 2012
If a poster honestly admits it's homework, then we will give hints rather than full solutions so they can't be accused of plagiarizing, and won't feel guilty about turning in someone else's code as their own. It appears that you imply this is not your homework, so don't worry about it.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Andrei Bobrov
Andrei Bobrov am 24 Dez. 2012
Bearbeitet: Andrei Bobrov am 24 Dez. 2012
m - your mean
s - your variance
size_matrix - size of your array < a x b > , size_matrix = [a,b];
fun1 = @(m,s,size_matrix) m + sqrt(s)*randn(size_matrix)
use function fun1, eg:
>> fun1(1,2,[3,2])
please read about randn
if you have Statistics Toolbox, use function normrnd:
>> normrnd(m,sqrt(s),size_matrix);
  6 Kommentare
vipul utsav
vipul utsav am 24 Dez. 2012
Bearbeitet: vipul utsav am 24 Dez. 2012
this is different question compared to you answered (homogeneous area...)
and i got solution
Image Analyst
Image Analyst am 24 Dez. 2012
Yes I know I answered a different question from you in a different discussion but the comment I made here was related to this discussion. Usually people care about what shape their noise distribution takes and I was just wondering why you don't, because it has a huge impact on the results. But whatever, as long as you think you have a solution....

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by