How to replace all row vectors except 1st according to the difference?

2 visualizaciones (últimos 30 días)
I have a matrix named as 'two' of size 100 x 4. I have also a singe row vector u=[-55 55 65 -65]; Let we find the error between 1st row of matrix two and u i.e.,
Error=two(1,:)-u;
Now I want to find 99 more Error elements from this single Error which are logrithmically decreasing. Then I want to replace all 99 row vectors of matrix two according to these 99 Errors. The matrix 'two' is in the mat file 4sn0dB.mat which is given in the attachment.
  2 comentarios
Kevin Holly
Kevin Holly el 16 de En. de 2023
"Then I want to replace all 99 row vectors of matrix two according to these 99 Errors"
How did you want to do this? Do you want to replace row with large error above a specific threshold? What will you replace the row with?
Sadiq Akbar
Sadiq Akbar el 16 de En. de 2023
Editada: Sadiq Akbar el 16 de En. de 2023
Thanks a lot dear Kevin Holly for your kind response. When I find the 1st Error i.e.,
Error=two(1,:)-u;
Then I want to extend this one Error into 99 such values which are logritmically decreasing values of this Error. Say for example the above 1st Error is Error=[0.001 -0.021 0.0021 0.015]. Now I want o find 99 more Errors from this single Error but those all should be logrithmically decreasing values of this. Then add the corresponding Error2 to u to get two(2,:). Likewise add Error3 to u to get two(3,:) and so on. Likewise for all 99 Errors, add them to u to get all 99 rows of updated two matrix.

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 16 de En. de 2023
Editada: Matt J el 16 de En. de 2023
two = (two(1,:)-u).*logspace(0,-5,100)' +u;
  2 comentarios
Sadiq Akbar
Sadiq Akbar el 16 de En. de 2023
Thanks a lot dear Matt J for your kind response. I did like below using your code:
clear all; clc
load 4sn0dB
two2 = (two(1,:)-u).*logspace(0,-5,10)' +u;
Both=[two two2]
But it gives me the following error:
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in ReplacingMatrix_twoRows (line 7)
Both=[two two2]

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices 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!

Translated by