Find mean and mean square root of each row in matrix without first row and column
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
How I can find mean and mean square root of 10*10 matrix for each row in matrix and save them in matrix C(:,1) without including first row and column. for example if matrix A is 4*4
1 3 3 4
2 5 7 6
8 4 9 4
2 1 6 9
how I can find mean and mean square root of each row in matrix without including first row (1 3 3 4)and first column (1 2 8 2) in calculation?
I do not want to delete them from matrix because I need them later in my calculations.
Regards
0 comentarios
Respuestas (1)
Star Strider
el 2 de Nov. de 2015
I am guessing that you want the root mean square of the rows, as well as the arithmetic mean, omitting the first row and the first column.
This will do that:
A = [1 3 3 4
2 5 7 6
8 4 9 4
2 1 6 9];
A_row_mean = mean(A(2:end, 2:end), 2)
A_row_rms = sqrt(mean(A(2:end, 2:end).^2, 2))
2 comentarios
Star Strider
el 2 de Nov. de 2015
Using your current matrix, if instead you wanted to eliminate columns 2 and 3 and row 3, the code changes to:
A_row_mean = mean(A([1:2 4], [1 4]), 2) % Without Row 3, And Without Columns 2 & 3
A_row_rms = sqrt(mean(A([1:2 4], [1 4]).^2, 2))
You have to specify the rows and columns you want to keep in the calculaton. Those you do not specify are not used.
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!