Find the difference between rows and substract it
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Márcia Vicente
am 4 Jul. 2019
Beantwortet: Guillaume
am 5 Jul. 2019
Hi,
So I have a Matrix (158x101), where the rows represent the number of steps, and the columns the length of the steps.
Since the steps are not starting all at the same time and have different lengths, this Matrix has Nans at the end to compensate for the shorter steps.
I want to find the step with the lowest starting value and then substract the difference from the values from that step by the other steps. In order to put them starting at the same time.
When plotting the steps I have now this:

Where the red *, represent the mean. And since I am losing a lot data to find the mean and I would like to put them, as I said before, starting at the same point.
% find the step with the lowest value
min_A1=min (Amtx1(:,1));
indice_min_A1=find(Amtx1 == min(Amtx1(:,1)));
That's what I have so far, the lowest value and the indice (or the number os the step, where that occours).
Not sure now how to do the rest.
Thanks in advance
9 Kommentare
Guillaume
am 5 Jul. 2019
Again, I don't understand how the shift of Amtx1 (your x axis) affects Amtx3 (the y axis). Could you give a simple example of inputs and desired output. E.g:
Amtx1 = [[1; 2; 3], [0.5; 1.5; 2.5] [2; 3; 4]] %3 columns of x values
Amtx3 = [[1; 2; 3], [2; 2; 2], [3; 2; 1]] %and corresponding columsn of y values
newAmtx1 = ??
newAmtx3 = ??
Akzeptierte Antwort
Guillaume
am 5 Jul. 2019
I'm not sure how that is diferent from shiftng to 0, but to achieve what you want:
shift = Amtx1(1, :) - min(Amtx1(1, :));
plot(Amtx1 - shift, Amtx3);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!