Plotting multiple inputs on a single figure
14 次查看(过去 30 天)
显示 更早的评论
Hello again
Does anybody know how i can plot a graph that looks like this or point me in the direction of a good tutorial that will help me figure it out? I have 8 sensor readings for a number of different movements and I want to display each sensors readings on a single figure like this opposed to using subplots, is this possible?
Thanks in advance
0 个评论
采纳的回答
Star Strider
2019-4-8
Example —
t = linspace(0, 36, 250); % Create Data
y = sin([1:6]'*t*2*pi); % Create Data
yofst = bsxfun(@plus, y, (1:size(y,1))'*2); % Add Constant Offset Values To Each Row
figure
plot(t, yofst)
grid
After that, you can do whatever you like with the tick values and labels. See the documentation for Axes Properties (link) and related functions.
Experiment to get the result you want.
4 个评论
更多回答(1 个)
Bob Thompson
2019-4-8
I you are looking for separate plots like that I would suggest using subplot. This will allow you to present multiple plots in one figure.
Alternatively, you can also plot multiple sets of data into one plot by entering 'hold on' somewhere before the second set of data is plotted (must be activated for each figure, if multiple figures are being created). I believe newer versions of Matlab automatically change the color of the lines for each data set, but it is also possible to do this manually.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!