# Modeling a voltage divider

## Summary

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.

Used this activity? Share your experiences and modifications

## Learning Goals

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

This is one of the first homework assignments for a sophomore-level introductory electronics course for physics majors. Students are given a take-home kit of parts and are expected to build circuits with resistors and a battery on a mini breadboard and measure output voltages for 5 sets of resistor pairs. Then students calculate the output voltages by hand. Students use MATLAB and Simulink to create functions, scripts, and models to verify their calculations. At this point in the semester, students are new to MATLAB and Simulink and a video playlist is provided with the teaching materials of the instructor walking through the creation and use of a similar MATLAB function and Simulink model. The video playlist includes other supplementary materials for building the circuits and performing the calculations.

## 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)

## 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.

## Assessment

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.

1. Selecting resistors (16 pts)
1. 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.
Note: Each resistor may only be used once
2. Building circuits and taking measurements(17 pts)
1. Build 5 circuits and measure output voltage at the point between the resistors
3. Calculations(16 pts)
• Calculate the output voltage for each of the 5 resistor pairs
4. Matlab function and Live Script (17 pts)
• complete function
• complete Live Script template
• accuracy of output voltages
• comparison of output voltages to calculations