How to put stacked plots in the same graph
Learn how to create stacked plots in MATLAB! This tutorial provides a clear guide on combining multiple plots into a single graph for easy data comparison. Get
Learn how to create stacked plots in MATLAB! This tutorial provides a clear guide on combining multiple plots into a single graph for easy data comparison. Get
To plot the data all in the same plot, do something like the following.
x1 = 0:.01:1; y1 = x1.^2; x2 = .5:.1:1; y2 = -1*x2 + 10; fHand1 = figure; aHand1 = axes('parent', fHand1); hold(aHand1, 'on') plot(x1, y1, 'parent', aHand1); plot(x2, y2, 'parent', aHand1);
To make the plots scale independent - so the min of the plot is at the bottom and the max is at the top - you need to normalize the y values before plotting. In this case, it helps to remove the y axis labels to avoid confusion. Here is how I did it.
y1 = (y1 - min(y1)) / (max(y1) - min(y1)); y2 = (y2 - min(y2)) / (max(y2) - min(y2)); fHand2 = figure; aHand2 = axes('parent', fHand2); hold(aHand2, 'on') plot(x1, y1, 'parent', aHand2); plot(x2, y2, 'parent', aHand2); set(aHand2, 'YTickLabel', [])
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.