"dony" wrote in message <email@example.com>... > hai, > I have some problem > and i need help > i have matrix in 100x100, and from this matrix i have some random selected data. > from this data, i want to make it(selected data) to be a center of 3x3 new matrix > and then from this new matrix i want to calculate mean and standart deviation. > thanks for help
% The last part should be simple % If A is your 3X3 "new" matrix, then
mean(A) % or mean(A(:)) % or some variation of that should give your mean value. % Use std in the same way to get the standard deviation
doc mean doc std
% Its not clear from your description how the "new" % matrix is derived from the original 100X100 matrix. % Can you provide an example?
% I'm guessing that if ii & jj are a location within % your 100X100 matrix (call it X) then perhaps:
A = X((ii-1):(ii+1),(jj-1):(jj+1))
% might be what you want. % Note: the above requires 1<ii,jj<100 % (can't be an edge).