Learning Plotting in Engineering applications
Summary
Learning Goals
Context for Use
This activity is a classroom exercise designed for a small class of 11 students from three different disciplines, with programming experience ranging from none to intermediate. It is conducted after students have learned basic MATLAB syntax and function definitions, serving as a reinforcement exercise to practice plotting and comparing mathematical and engineering signals.
Students are expected to have basic MATLAB skills, including familiarity with the command window and script editor, creating vectors using linspace or colon notation, performing element-wise operations (.^, .*, ./), and using basic plotting commands (plot, hold on, legend, xlabel, ylabel, title).
They should also have mathematical preparation, including algebra, trigonometry, and matrix operations, or permission from the instructor.
The activity takes enough time to allow students to experiment, encounter syntax errors, and learn to use MATLAB's help functions independently.
Covered in the first quarter of the course, it is easily adaptable to other courses or disciplines such as mathematics, physics, or engineering with minimal modification.
Description and Teaching Materials
Activity Mechanics and Materials:
In this activity, students are asked to define and plot multiple mathematical and engineering functions in MATLAB to compare their behaviors on a single 2D graph. The activity begins with a brief review of MATLAB syntax for creating vectors, defining functions, and using element-wise operations (.^, .*, ./). Students then implement a set of predefined functions, including linear, quadratic, exponential, sinusoidal, square wave, sawtooth, and composite signals. They use MATLAB's plot command to visualize all functions together, experimenting with different colors, line styles, legends, and labels to clearly distinguish each function. Students are encouraged to troubleshoot syntax errors and consult MATLAB's built-in help system to reinforce independent problem-solving skills.
Materials Needed:
MATLAB software (any version supporting basic plotting functions).
Pre-prepared MATLAB script template (editable .m file) with example function definitions and plotting skeleton.
Optional reference materials: MATLAB documentation for plotting functions: https://www.mathworks.com/help/matlab/plotting.html
Role of MATLAB and Alternative Software:
MATLAB is used for both computation and visualization, allowing students to evaluate mathematical expressions and immediately see results plotted graphically. While this activity could technically be implemented in other software such as Python (with matplotlib) or R, MATLAB was chosen for its widespread use in engineering curricula, robust plotting tools, and built-in support for vectorized operations, which makes it particularly suited for reinforcing function evaluation and visualization concepts.
File/Material Descriptions:
PlottingActivity_Template.m – Editable MATLAB script with vector definitions, function placeholders, and basic plotting commands. Students complete the script and generate plots as part of the activity.
MATLAB documentation link – Provides detailed explanations of plotting commands and examples for students to reference during the activity.
Notes for Faculty:
All materials are provided in editable formats to allow instructors to modify function definitions, plotting styles, or extend the exercise to include additional signals or more advanced concepts. The activity can be completed in a single class session, and students do not require prior experience beyond basic MATLAB familiarity.
Plotting Activities for Engineering Students (Matlab File 2kB Oct7 25)
Teaching Notes and Tips
Student Prep: Review vector creation (linspace, :), element-wise operations (.^, .*, ./), and basic plotting commands. Have MATLAB help open.
Common Confusions: Forgetting element-wise operators, mismatched vector sizes, missing hold on, and unlabeled plots.
Instructor Tips:
1. Demonstrate plotting one function first, then add more.
2. Encourage experimenting with colors, line styles, and markers.
3. Prompt use of help for troubleshooting syntax errors.
4. Discuss observed differences in function behavior (growth, oscillation, amplitude).
Maximizing Learning: Save annotated plots, modify/add functions, and encourage students to pair up, especially with someone of higher or lower experience levels.
Practical: Turn on your computer and open MATLAB (Believe it or not, I have had to actually tell them to do this during class). This is fully computer-based; ensure students have MATLAB access.
Reinforcement: Connect plots to real-world signals (AC waveforms, damped oscillations), explore 3D or advanced plotting.