Shifting a line on the x-axis ONLY
15 次查看(过去 30 天)
显示 更早的评论
I have function
q = [0:0.01:2];
plot(20*q.^2, q.^2)
It's just a straight line. I want to move it from x = 0 to x = -50. I tried circshift but that didn't work. Any ideas?
q = [0:0.01:2];
plot(circshift(20*q.^2, -50), q.^2)
1 个评论
Simon Chan
2023-6-7
circshift is going to shift the position of your data, but not its value.
Why not simply -50.
q = [0:0.01:2];
plot(20*q.^2-50, q.^2)
采纳的回答
更多回答(1 个)
Shivam
2023-6-7
If I am not wrong you want to achieve something like this only right ?
You can achieve this easily by following changes in code :
q = [0:0.01:2];
plot(20*q.^2-50, q.^2)
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!