ENGR 11, Laboratory 5: Electrify the Linear-Systems Problem

Incomplete draft 1


Purpose of this lab:

One of the main ideas in scientific computation is to use computers to solve problems in Science, Technology, Engineering, and Mathematics (STEM) fields. When we think about these types of problems, there are a number of reasons we might want to leverage computers as powerful tools:

A. Coding, while sometimes tedious and time consuming, is much less expensive than physical labor. In other words, often it is less expensive to write code than it is to run physical exper-iments that require months or even years in a laboratory setting using expensive equipment. There are substantial or prohibitive costs associated with testing new ideas in real-world set-tings. If we can find ways to simulate experiments on a computer, develop ideas, and refine the design of a process, product, or technique using computation, this can be a cost-effective method to do due-diligence before embarking on a the expensive physical design problem.

B. Present-day life is filled with computation. So much of our scientific, computational, and engineering infrastructures depend on digital data. When we write code to take advantage of this data, we leverage decades of work done to create this data in order to develop new solutions to pressing problems. Certainly this is not an excuse to value computers over humans. Instead, this is an invitation to think critically about how to leverage technology in this world to benefit your community in ways that align with your core beliefs, academic/career interests, and the values you hold most dear in your heart.

C. Sometimes there are very important problems in science for which experimentation and labo-ratory studies are unethical or impossible. In these cases, developing a comparable computa-tional experiment empowers us to study important problems based on fundamental principles without having to run unethical research studies. In the best case scenario, these type of studies may push the frontiers of human knowledge to new spaces and lead to breakthroughs in our understanding of hard problems.

D. Computers empower us to experience life on time scales that are not native to the human experience. Human perception operates effectively on time scales that are perhaps bounded below by 100 1 seconds for most mundane experiences not performed by world-class experts. In contrast, over the last 70 years, we have seen the development and large-scale manufactur-ing of extremely refined instrumentation (computers) that can function as intended on time scales of 100 15 seconds. Computers can leverage data on these time scales. By developing software to study phenomenon based on collected data, we sometimes can build intuition about experiences that are unobservable using innate human senses. This has the effect of augmenting our ability to perceive and study our physical surroundings.

In this lab, we get experience working on a problem to highlight items A and B on this list above. Specifically, we explore how much time it takes to build a physical apparatus and measure data. We also explore how much time it takes to write MATLAB code to simulate the physical measurement process. We do this work in the context of a modeling problem that relates to circuit analysis, linear algebra, and electricity.


1. Learn how to write MATLAB Functions

In this problem, you will learn more about MATLAB function files. I have not yet finished my YouTube video build on this subject. Moreover, I want to help you learn how to effectively teacher yourself how to use MATLAB using the documentation center. What better way to practice this skill than teaching yourself how to write MATLAB functions by reading a selection of relevant articles in MATLAB’s documentation.

Open MATLAB. In the Command Window, execute the following command: doc function basics. Click on the function basics item in the search query and read the entire article on this subject. From this main landing page, do each of the following:

A. Read the article on the proper syntax for a MATLAB function.

B. Under the Examples and How To section, read the Create Functions in Files article.

C. Under the Examples and How To section, read the Add Help for Your Program article.

D. Under the Examples and How To section, read the Run Functions in the Editor article.

E. Extremely motivated students can read through all the links under the Concepts and Troubleshooting sections to learn more about how MATLAB deals with functions, though this extended knowledge is not necessary to successfully complete Lab 5.


      Scientific Computation in Action

      One of the most beautiful features of scientific computation is the deep connection between prac-tical applications, mathematical theory, and computer code. To make these connections explicit, we need to translate physical phenomena into corresponding mathematical concepts. In this lab exercise, we transform a real-world context arising in our observable world into a coding problem. We also highlight how many of the techniques we explored in the first few weeks of this class can be used to solve this problem. In the process, we discuss important challenges in using computers and algorithms to analyze real-world data. We begin with a statement of the most important and nuanced problem in applied mathematics.


The Applied Math Modeling Problem

      Find and solve real-world problems using the applied math modeling process. In sci-entific computation, we focus on transforming our real-world problem into an ideal math-ematical model. The entire MATLAB programming language is built on the paradigm that vectors and matrices are powerful data structures that we can use to model and study scientific processes.

      

      Scientific computation focuses on solving real-world problems using mathematical models that are implemented as computer code. In this course, we define a real-world problem to be a set of questions used to illicit information that can be stated using quantitative data observable by humans beings. Very often, real-world problems are created by scientific and entrepreneurial thinkers in order to address some specific need of a society. Many real-world problems arise in the study of the physical, biological, chemical, or social spheres of our existence. Let’s investigate the nature of applied mathematical modeling process. By doing so, we can learn to identify the different patterns has four distinct phases and is iterative.


Definition: Real-World Problem

      We define a real-world problem to be a set of questions used to illicit information that can be stated using quantitative data observable by humans beings.

    

  The first phase of this process begins by identifying a real-world problem, which we can think about as any problem that matters in our lives and that can be studied by making observations. The practice of observing problem dynamics is more formally known as the collection of measured data though this distinction usually exists only in the mind of trained scientists. One of the fascinating features of real-world problems is that by identifying and imagining the problem, we likely develop some idea of what a meaningful solution might be. However, from the standpoint of applied mathematics, a valuable real-world problem usually includes major obstacles that block the path between the problem statement and our desired solution. In order to earn healthy paychecks, applied mathematicians pray that such obstacles are so prohibitive that spending months or years doing tedious mathematical analysis proves to be much more productive and economical than trying to solve the problem using brute force.

      Assuming that we’ve identified a real-world problem in which mathematical modeling seems more hopeful than physical labor, we move on to the second phase of the applied mathematical modeling process. In this stage, we mathematize our real-world problem by transforming measurable data and nonmathematical objects into a collection of relevant mathematical ideas. This might include introducing useful mathematical notation, defining relevant variables, imposing appropriate mathematical assumptions, and focusing on a subset of important problem characteristics while ignoring other aspects of the problem.


Figure 1: Diagram of the applied mathematical modeling process. Applied modeling begins with a real-world problem.

      As we see in this laboratory exercise, there are many subtleties and nuances involved in mathe-matizing a real-world problem to produce a corresponding ideal mathematical model that actually models key aspects of the problem. In good applied mathematics and scientific computation, this is where interdisciplinary teams prove to be invaluable. Each professional is trained in a particular field. By combining talents with a growth mindset and some luck, great learning might result in a useful modeling scheme.

      Once we’ve decided on an ideal mathematical modeling scheme, phase three of this process involves a painstaking effort of mathematical analysis. Such analysis includes a search for the most powerful mathematical theorems and tools that can be brought to bear on our problem. For a good real-world problem, this type of applied mathematical analysis requires deep thinking about the mathematical objects we use in our model and many hours of iterated failure until we converge on the most potent mathematical ideas. A good motto for this stage is “error and error and error, but less and less and less.”

      The dream of applied mathematics and scientific computation is that we might analyze our ideal model using a suite of technical mathematical results and produce an ideal solution to this problem. The fantasy of applied mathematics is that the ideal solution we produce via mathematical analysis leads to valuable progress in discovering aspects of the meaningful real-world solution that we so desire. The major insight behind scientific computation is to do the mathematical analysis using digital computers. This includes writing code, running code, debugging, and creating software projects. The major goal of this work is to analyze the ideal mathematical models to produce some desired data that is unknown and desired. The output of our program is known as the solution to our ideal mathematical modeling problem.

      One of the major reasons that we force students in STEM fields to take college coursework in mathematics and scientific computation is that we want our students to be able to use mathematics to accurately analyze problems that may arise in their future careers. However, a major tragedy of many college mathematics classes is that most of the applied mathematical modeling process is hidden from view. Instead, students in our college math classes focus only on mathematical analysis techniques that are required to analyze an ideal mathematical model and produce a corresponding ideal solution. Indeed, it is very seldom that young students get a chance to participate in all four steps of the applied modeling process prior to the end of their undergraduate degree. It is even more rare that students observe this process in action while completing their lower division courses in mathematics. We see evidence of this missed opportunity when students ask “when will I use this material?” or “how is this applicable in the real world?”

      The modeling activity you complete in this lab is designed to provide a compelling answer to these questions. This is part of the Jeff’s larger development program to enrich our society’s ability to teach introductory courses in applied linear algebra and scientific computation. The ultimate goal of these types of modeling activities is to provide interested learners with access to valuable mathematical modeling experience that illustrate all four phases of the applied modeling process. The hope is that these types of activities enriches your understanding of how linear algebra and scientific computation is used in practice. The particular activity presented in this laboratory exer-cise is especially relevant for students who want to earn degrees in electrical engineering, computer science, mechanical engineering, physics, or applied mathematics.


2. Understand the Real-World Problem

As seen in the description above, the first part of a good scientific computation project involves a deep dive into a real-world problem. Such study can be quite intense and might last many years in the wild terrain of a well-funded science study. The first major milestone that we can achieve in our work on a scientific computation project is to understand the problem. I like to say that building a deep and meaningful understanding of a problem is at least 50% of the total work needed to solve the problem.

In Problem 2 of Lab 5, you will spend dedicated energy focused on understanding a very classic problem in physics and electrical engineering. This problem is known as the circuit analysis problem. In truth, this is actually a collection of an infinite number of problems. The goal of any circuit analysis problems is to completely describe the electrical behavior of a physical circuit by capturing accurate values for all circuit variables in the circuit. In order to learn more about what this means, you will complete all of the following items.

A. Get a thorough introduction to the Electronics Learning Laboratory Kits we use in this course. To do this you can do the following:

 (2.A.i) Watch all 11 Videos in the Unit 1 Project, Part 1 Playlist: Introduction to the Electronics Learning Laboratory Kit.

 (2.A.ii) Read the Intro to Electronics Learning Lab Kit Workbook, Part 1

 (2.A.iii) Read the Intro to Electronics Learning Lab Kit Workbook, Part 2

 (2.A.iv) Construct the Example 1 Circuit on page 12 - 13 of the Intro to Electronics Learning Lab Kit Workbook, Part 2. make the four measurements

 (2.A.v) Make all four measurements on page 13 from the Example 1 Circuit. You will be submitting your measurements as part of your lab.

B. Learn how to measure circuit variables using a digital multimeter. In order to take your first measurements, please do the following:

 (2.B.i) Watch all 6 Videos in the Basic Concepts in Circuit Analysis.

 (2.B.ii) Read the Basic Concepts in Circuit Analysis Workbook

 (2.B.iii) Finish pages 21 - 49 of this workbook. Specifically, build all example circuits including examples 2, 3, 4, 5, 6, 7, 8, 9. Take all measurements suggested in this workbook. You will be submitting your measurements as part of this lab.


3. Create and analyzes your Ideal Mathematical Model

The next stage of a good scientific computation project focuses on creating an ideal mathemat-ical model. The process for creating such a model is known as mathematization. This process draws on your understanding of physical and scientific principles from your non-mathematics classes in your college degre.

In this Lab 5, Problem 3, you spend dedicated energy mathematizing the problem of circuit analysis for electric circuits that are built from resistors, dc voltage sources, and dc current sources. In the process of creating the mathematical models for these circuit analysis prob-lems, you learn how to using matrices and vectors to describe scientific variables. You also will be setting the foundation to write code to analyze this scientific problem. This process is at the heart of good scientific computation projects. As you complete problem 3, you build deep experiential knowledge of to mathematize a problem in such a way to leverage MATLAB’s computational tools with a focus on matrix computations.

A. Build the LANA Example 2 circuit and take all 31 circuit measurements :

 (3.A.i) Watch the videos LANA Example 2: Circuit Model Verification.

 (3.A.ii) Build the LANA Example 2 circuit.

 (3.A.iii) Make all 31 measurements for the circuit variables.

 (3.A.iv) Capture all 31 measurements and submit these as part of your lab 5 report.

 Capture using an excel spreadsheet OR

 Use the LANA Example 2 Blank Measurement Template.

B. Learn how to mathematize the LANA Example 2 circuit analysis problem :

 (3.B.i) Watch all 16 Videos in the playlist titled LANA: Example 2.

 (3.B.ii) Read the LANA Example 2: Full Solutions Write Up

 (3.B.iii) Read the Quick reference guide to the LANA algorithm.

 (3.B.iv) Read the Step-by-step guide to the LANA Algorithm

 (3.B.v) Optional:Take a look at the LANA Example 2: MATLAB Script File

 (3.B.vi) Optional: For curious minds, read the LANA Algorithm Variable Guide


4. Try for yourself on your own circuit

Now that you’ve got a sense of how the LANA algorithm works in practice, try the entire modeling process for yourself on a new circuit example.

A. Build the LANA Example 3 circuit and take all 39 circuit measurements :

 (4.A.ii) Build the LANA Example 2 circuit.

 (4.A.iii) Make all 39 measurements for the circuit variables.

 (4.A.iii) Capture all 39 measurements and submit these as part of your lab 5 report.

 Capture using an excel spreadsheet OR

 Use the LANA Example 3 Blank Measurement Template.

B. Implement the LANA algorithm to analyze the Example 3 circuit

 (4.B.i) Write a MATLAB script file to create modeled data. Compare your modeled data to the measurements you made in problem 4A. Reflect on your observations.