lundi 3 août 2015

Add random number to cell of matrices

I have a cell, A of size 1 by 625. i.e.

A = { A1, A2, ..., A625},

where each of the 625 elements of the cell A are 3D matrices of the same size, 42 by 42 by 3.


Problem 1

Since the entries of my matrices represent concentration of red blood cells which are of very small values and I cannot simply work with randn.

For each of the matrix, I try with this command, e.g.:

A1 = A1 .*(1 + randn(42,42,3)/100)

I try with dividing by 100 to minimize the possibility of very negative number (e.g. 1.234e-6) but I cannot eliminate this possibility.

Also, is there any quick way to add different randn(42,42,3) to different 625 matrices. A + randn(42,42,3) won't work because it is adding the same set of random numbers.


Problem 2

I want to make 30 copies of the cell A by adding random numbers to each of entries of the 625 matrices. That is, I want to obtain a cell, Patients which is a cell of 1 by 30 and each of the cell element is another cell element of 625 matrices.

Patients = A % Initialization. I have 30 patients.

for i = 1 : 30;
   Patients = { Patients, Patients + `method from problem 1`};
end

I have tried to make my problems clear. I appreciate so much for your help.




Aucun commentaire:

Enregistrer un commentaire