MATLAB Answers

Plot several graphs with distance in Y-axis!

27 views (last 30 days)
M G
M G on 12 Sep 2013
Hi Matlab experts,
If we have matrix M with the size 20x100. I want to plot 20 rows (each row has 100 points) in one figure in a way that graphs do not overlap on each other. How can I plot them with distance from each others on Y-axis while preserving the scaling? Something similar to EEG.
Thanks for your help. Mehdi

  0 Comments

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 12 Sep 2013
Here's one way:
% Create some data
M = 0.3*rand(20,100);
offset = 1; % Make this big enough to prevent offset
offset_vector = (offset:offset:20*offset)';
M_plus_offset = bsxfun(@plus,M,offset_vector);
figure
plot(M_plus_offset')

  0 Comments

Sign in to comment.

More Answers (0)

Tags