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

2 vues (au cours des 30 derniers jours)
Sadiq Akbar
Sadiq Akbar le 16 Jan 2023
Commenté : Matt J le 16 Jan 2023
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 commentaires
Kevin Holly
Kevin Holly le 16 Jan 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 le 16 Jan 2023
Modifié(e) : Sadiq Akbar le 16 Jan 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.

Connectez-vous pour commenter.

Réponse acceptée

Matt J
Matt J le 16 Jan 2023
Modifié(e) : Matt J le 16 Jan 2023
two = (two(1,:)-u).*logspace(0,-5,100)' +u;
  2 commentaires
Sadiq Akbar
Sadiq Akbar le 16 Jan 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]
Matt J
Matt J le 16 Jan 2023
Should be logspace(0,-5,100)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by