Download presentation
Presentation is loading. Please wait.
Published byGeoffrey Kerry Oliver Modified over 9 years ago
1
2D Plots 2 ENGR 1181 MATLAB 13
2
Plotting in the Real World 2D plots generated by MATLAB can be used in a variety of fields, including the one shown here, which is showing life expectancy vs. literacy rates vs. population in various continents.
3
Today's Learning Objectives After today’s class, students will be able to: Create other 2D graphing options in MATLAB (e.g., log, bar, subplot, fplot). Select the proper opportunities to utilize aforementioned 2D graphing options.
4
The fplot() Command >> fplot('function', [limits]) The fplot() command lets you plot a function instead of using vectors of x and y values Only one variable can be referenced in the function Function is entered as a string Limits are entered as a vector
5
The fplot Command Plot the function y = x^3 + 2x^2 -5 for -3<x<3: >> fplot('x^3 + 2*x^2 -5', [-3,3]) Remember that only one variable can be in the fplot() command and that the function is entered as a string
6
Polar Plots >> polar(theta, r) The polar command plots functions with coordinates r and Ɵ. r and Ɵ must be equal length vectors, and Ɵ is in radians Use 'hold on, hold off' to plot multiple curves.
7
Subplots >> subplot(rows, columns, plot #) Use before typing the plot command Specifies the location of the subsequent plot Ex: subplot(2,2,3) plot(x,y3) title('Subplot 3: sin(4x)')
8
Important Takeaways The fplot() command can be used to plot functions Polar plots can also be generated using the polar() command Multiple plots can be organized in the same figure with the subplot() command
9
Preview of Next Class Functions I What is a function? Introduce basic structure of MATLAB functions Provide examples of functions
10
What’s Next? Review today’s Quiz #13 Open the in-class activity from the EEIC website and we will go through it together. Then, start working on MAT-13 homework. Prepare for the next class by reading about MATLAB Functions 1.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.