Stacked plot /waterfall plots to visulaise figures
30 views (last 30 days)
Show older comments
I have in total 6 signals and would like to see all in a single plot.Since all having same X axis and Y axis (shall normalise it).
How shall I see all in a single waterfall plot?
Thanks in advance.
t=[0:.01:6]*1e-5;
e=zeros(length(t),6);
e(200:end,1)=12.5*cos(1.3e6*t(200:end) ).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,2)=11.8*cos(1.3e6*t(200:end)+pi/2).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,3)= 8*cos(1.3e6*t(200:end)-pi/2).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,4)= 6.2*cos(1.3e6*t(200:end)+pi ).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,5)= 7.2*cos(1.3e6*t(200:end)+pi/3).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,6)= 8.2*cos(1.3e6*t(200:end)-pi/3).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
%combined plot
plot(t,e(:,1),'r-',t,e(:,2),'g-',t,e(:,3),'b-',t,e(:,4),'c-',t,e(:,5),'m-',t,e(:,6),'y-');
xlabel('Time (s)'); ylabel('Strain');
legend('5','10','20','30','40','50');
0 Comments
Accepted Answer
Dave B
on 10 Sep 2021
Edited: Dave B
on 10 Sep 2021
If you want to put these data into a waterfall, you can do waterfall(e') but that won't get your time axis correct. Using meshgrid is an easy way to get x and y values in the right shape for waterfall (or mesh)
t=[0:.01:6]*1e-5;
e=zeros(length(t),6);
e(200:end,1)=12.5*cos(1.3e6*t(200:end) ).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,2)=11.8*cos(1.3e6*t(200:end)+pi/2).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,3)= 8*cos(1.3e6*t(200:end)-pi/2).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,4)= 6.2*cos(1.3e6*t(200:end)+pi ).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,5)= 7.2*cos(1.3e6*t(200:end)+pi/3).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,6)= 8.2*cos(1.3e6*t(200:end)-pi/3).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
n = [5 10 20 30 40 50]; % guessing from legend
[xi,yi] = meshgrid(t,n);
waterfall(xi,yi,e')
4 Comments
More Answers (0)
See Also
Categories
Find more on Line Plots 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!