Moving graph along x-axis
显示 更早的评论
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 个评论
Torsten
2022-4-17
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
2022-4-19
采纳的回答
更多回答(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));
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
