Modeling a voltage divider
This activity was selected for the Teaching Computation in the Sciences Using MATLAB Exemplary Teaching Collection
Resources in this collection a) must have scored Exemplary or Very Good in all five review categories, and must also rate as “Exemplary” in at least three of the five categories. The five categories included in the peer review process are
- Computational, Quantitative, and Scientific Accuracy
- Alignment of Learning Goals, Activities, and Assessments
- Pedagogic Effectiveness
- Robustness (usability and dependability of all components)
- Completeness of the ActivitySheet web page
For more information about the peer review process itself, please see https://serc.carleton.edu/teaching_computation/materials/activity_review.html.
This page first made public: Oct 7, 2016
This is a homework assignment in a course in electronics for sophomore-level physics students on the topic of voltage dividers. At the start of the semester, students receive a kit of electronic components including a mini breadboard, resistors, and a battery. Students choose 5 sets of 2 resistors to create voltage dividers and build each of the circuits and measure the output voltage. They calculate the output voltage at the point between the resistors. Students then create a MATLAB function and a Simulink model to verify their results. In the process, students learn to create and use functions in MATLAB, vary parameters in their functions, and build circuit models in Simulink. Finally, students plot their measured output voltage values, fit a line, determine the slope, compare to calculated values and calculate percent error.
Students will learn to (a) select pairs of resistors to build voltage dividers that have output voltages varying from 20% to 80% of the input voltage with a current less than 20 mA, (b) build the circuits and measure the output voltages, (c) calculate the output voltage at a point between the resistors, (d) create and use a MATLAB function to verify the output voltage calculations for different input voltages and resistors, (e) create a script that calls their MATLAB function and computes the values for each circuit, (f) create a Simulink model to verify the output voltage calculations in (a), and (f) plot and fit their measured output values and calculate percent error.
Context for Use
Description and Teaching Materials
At the start of the semester, students are given a kit of parts including approximately 20 resistors. In this assignment, they select 5 resistor pairs to create voltage dividers such that the output voltage is between 20% and 80% of the input voltage. Students build the circuits and measure and calculate the output voltage for each. They create a MATLAB function and use it in a script to verify each of their calculations. They also build a Simulink model of the voltage divider and vary the inputs to model each of the 5 resistor pairs. Students are given the link to the video playlist that includes instructions for each of the tasks in the assignment including instructions about how to build the circuits, do the calculations, and create and use a MATLAB function as well as a Simulink model.
A template script and a complete script are included to share with students and for instructor use, respectively.Voltage Divider Assignment (Acrobat (PDF) 54kB Jan5 19)
Voltage Divider Project in Word (Microsoft Word 2007 (.docx) 20kB Jan5 19)
MATLAB function (Matlab File 99bytes Jan4 19)
MATLAB Live Script voltage divider (MATLAB Live Script 24kB Jan5 19)
MATLAB Live Script voltage divider template (MATLAB Live Script 5kB Jan5 19)
Simulink model of a voltage divider ( 23kB Jan5 19)
Click here for the video playlist: video playlist
Teaching Notes and Tips
Videos are provided with the teaching materials to assist and instruct students on building the circuits, calculating the output voltages, creating and using a MATLAB function, and building a Simulink model. Specifically, videos explaining how to create a similar MATLAB function and Simulink model are included in the link to the playlist. This is appropriate for students new to MATLAB and Simulink. Students are very comfortable with plotting and fitting from prior general physics lab courses and guidance on plotting and fitting is not included. However, you may want to modify the template for your students. The videos may be omitted for students with more experience. In the author's experience, students are able to complete this assignment entirely on their own as long as they are made aware of the videos.
Students are assessed approximately equally on selecting resistors, building circuits and taking measurements, calculations, Matlab Live Script with function, Simulink model, and plotting, fitting, and calculating percent error.
- Selecting resistors (16 pts)
- 5 pairs of resistors that cover the output voltage range of 20% to 80% of the input voltage and result in a current less than 20 mA.
- Building circuits and taking measurements(17 pts)
- Build 5 circuits and measure output voltage at the point between the resistors
- Calculations(16 pts)
Note: Each resistor may only be used once
- Calculate the output voltage for each of the 5 resistor pairs
- complete function
- complete Live Script template
- accuracy of output voltages
- comparison of output voltages to calculations
- creation of the circuit in Simulink
- input values for resistors for each circuit
- output voltage values displayed on the scope or display
- comparison of Simulink output voltage values to calculations
- Plot of measured values
- fitting a line to the data, using polyfit
- create the line of best fit using polyval
- plot the line of best fit
- calculate percent error of the slope of the line of best fit and the input voltage