% MATLAB Tutorial - Nuclear Science and Engineering - Spring 2008 % Instructor: Violeta Ivanova, violeta@mit.edu % Faculty: Jacquelyn Yanch, jcyanch@mit.edu % EXAMPLE 1 2D Plots and Subplots %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % A. LOAD DATA % Load data from file response.dat using Import Wizard % Hint: use Create Vectors from Columns option. % Use WHO to confirm you have created vectors T, YI, and YO. who %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % B. PLOTTING % B1. Create a figure with two subplots one above each other. % Plot the input YI and the response YO vs. time T on the top subplot % (use different colors and/or markers). Add figure title and subplot legend. subplot(211) plot(T, YI); hold on plot(T, YO, 'r-'); hold off legend('INPUT', 'RESPONSE') title('AMPLITUDE AND PHASE CHANGE') % B2. In the second subplot, graphically determine the changes in % amplitude and phase. % Hint: Plot the same figure as above, then change the x-axis range using % the Property Editor. subplot(212) plot(T, YI) hold on plot(T, YO, 'rx') hold off