Getting a plot to wrap from right to left
显示 更早的评论
Hello, All. I have a set of points to plot and fit a function (the end result should be a sine function). Here's the code I'm using and it works just like you'd expect it to:
x = [-65.0600; -0.5310; 71.5820; 137.4960; -153.9860; -87.7790];
y = [0.1000; 18.9260; 11.4630; -12.4760; -18.9610; 1.5900];
plot(x, y, 'ro', 'MarkerSize', 10);
interpolatedX = linspace(min(x), max(x), 500);
interpolatedY = spline(x,y,interpolatedX);
hold on;
plot(interpolatedX, interpolatedY, 'b-', 'LineWidth', 3);
grid on;
xlabel('longitude');
ylabel('latitude');
The problem is it's not what I need. Rather than try to explain, I've attached a .jpg of what I'm trying to achieve. I'd prefer to have the plot to wrap from right to left, as shown. If that's not possible, the entire plot can shift. The bottom line is that the interpolated line needs to start with x(1),y(1), end with x(6),y(6) and fit a sine function. Thanks for the help!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Splines 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!