在 Matlab 图中连接点

Connect Dots in the Matlab plot

我正在 Matlab 绘图中绘制点。我想在绘制点时连接点。我不知道该怎么做。这是使用的代码片段:

for index=2:length(x1(1:100))
    hold on;
    plot(x1(index), x2(index), 'r*', 'markers',3);
end

您是否考虑过绘制最后一个点和到前一个点的线:

for index=2:length(x1(1:100))
    hold on;
    plot(x1(index + (-1:0) ), x2(index + (-1:0) ), '-*r', 'markers',3);
end