how to plot two variables having different length y1 it's size (1x1500) and y2 (1x1200) at the same figure according to steps in time (X-axis)
2 次查看(过去 30 天)
显示 更早的评论
I'm actual doning random walk with different lengths and i want every variables has a color like this ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1424203/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1424203/image.png)
0 个评论
采纳的回答
Voss
2023-7-1
% two random vectors of different lengths
y1 = cumsum(randn(1,1500));
y2 = cumsum(randn(1,2000));
% plot them
plot(y1)
hold on
plot(y2)
xlabel('Step #')
ylabel('Position')
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Standard File Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!