plotting many signals in one plot
8 views (last 30 days)
Show older comments
Hi,
I'm trying to plot 3 variables (time,stations,amplitude of the signals)in the same plot. Now, I have a number N of station, and a number N of signals associated with the stations,the amplitude of each signal goes from lets say, -1 to 1, also, all the signals have the same duration. So what I want to plot is: time in the X-axis, stations in one of the Y-axis, and amplitude in the other Y-axis. The problem is the amplitude axis, because if I want to associate the signal to the station, that means that the amplitude scale (-1 to 1) should be repeated N times along the axis and that's what I do not know how to do.
Here is basically what I want (without the colors of course): http://ars.els-cdn.com/content/image/1-s2.0-S1367912011004962-gr5.jpg
Any help is appreciated!
A.T.
1 Comment
Answers (1)
Image Analyst
on 2 Dec 2012
Is this kind of what you're looking for (the plotyy function)?
% Make time have 60 elements from 0 to 100 inclusive.
t = linspace(0, 100, 60);
% Generate randomstuff for amplitude and stations.
numberOfElements = length(t);
amplitude = 2*rand(numberOfElements, 1) - 1;
stations = 4 * rand(numberOfElements, 1);
% Plot both, one on each vertical axis
plotyy(t, amplitude, t, stations);
grid on;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
Otherwise look at the ylim() function.
2 Comments
Image Analyst
on 2 Dec 2012
You'll most likely have to do something custom for that - at least I've never seen it in MATLAB before. The closest thing I've seen is the waterfall() function, but that's not what you want, I don't think.
See Also
Categories
Find more on Two y-axis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!