Moving graph along x-axis
Afficher commentaires plus anciens
Hi,
I am trying to plot 3 different vectors that showcase the same function but with different starting points from the y-axis.

Now what I wanna do is move the yellow and the red graph so they overlap with the blue one, to see wether my determined data actually is correct. I have another picture here to further show what exactly I mean:

Now I have tried to do something similar but with the y-axis but unfortunately I couldn't make it work.
What would be a clever way to move the graphs without having to change the values of the vectors?
2 commentaires
Torsten
le 17 Avr 2022
Now what I wanna do is move the yellow and the red graph so they overlap with the blue one, to see wether my determined data actually is correct.
Better work with the data, not with the graphics.
Sokratis Panagiotidis
le 19 Avr 2022
Réponse acceptée
Plus de réponses (1)
Let's call your 3 data sets (x0,y0), (x1,y1), (x2,y2) where (x0,y0) are your target data points. Then I might try something like this:
x1_shifted=x1-mean(x1)+mean(interp1(y0,x0,y1));
x2_shifted=x2-mean(x2)+mean(interp1(y0,x0,y2));
Catégories
En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
