Cuyamaca College Practice Defining and Using Your Own Functions Math Lab

The purpose of this lab is to practice defining and using your own functions in MATLAB. For this exercise, we will be writing a circuit solver for three resistors in series: ![Superposition4.PNG](https://gcccd.instructure.com/courses/37021/files/4506842/preview) Figure 1. Series Resistive Circuit and three resistors in parallel: ![parallel2.PNG](https://gcccd.instructure.com/courses/37021/files/4507127/preview) Figure 2. Parallel Resistive Circuit ### Procedure As usual, include a comment at the top explaining the purpose of the script, your name, and the date it was created. 1. Create a main script called main.m. In this script, you will be: 1. Creating three variables for three resistance values and a variable for the voltage source value. Be sure your variable names reflect what the variable is storing. 2. Calling functions and storing output for computing the series and parallel equivalent resistances, and power. 3. Communicating with the user. 2. Create a function that computes the equivalent resistance for resistors in series. The function should take in as input the three resistance variables you defined in your main function and it should return as output the equivalent resistance. For series resistors, equivalent resistance is: ![LaTeX: Equivalent\:Resistance\:=\:R1\:+\:R2\:+\:R3…](https://gcccd.instructure.com/equation_images/Equivalent%255C%253AResistance%255C%253A%253D%255C%253AR1%255C%253A%252B%255C%253AR2%255C%253A%252B%255C%253AR3…)E q u i v a l e n t R e s i s t a n c e = R 1 + R 2 + R 3… 3. Create a second function that computes the equivalent resistance for resistors in parallel. The function should take in as input the three resistance variables you defined in your main function and it should return as output the equivalent resistance. For parallel resistors, equivalent resistance is: ![LaTeX: Equivalent\:Resistance\:=\:\frac{1}{\frac{1}{R1}+\frac{1}{R2}+\frac{1}{R3}…}](https://gcccd.instructure.com/equation_images/Equivalent%255C%253AResistance%255C%253A%253D%255C%253A%255Cfrac%257B1%257D%257B%255Cfrac%257B1%257D%257BR1%257D%252B%255Cfrac%257B1%257D%257BR2%257D%252B%255Cfrac%257B1%257D%257BR3%257D…%257D)E q u i v a l e n t R e s i s t a n c e = 1 1 R 1 + 1 R 2 + 1 R 3 . . . 4. Create a third function that computes current and power delivered by the voltage source. Your function should take in as input the equivalent resistance and return two outputs, current and power. Let equivalent resistance be denoted Req, then, current and power are: ![LaTeX: Current\:=\frac{\:Voltage}{Req}](https://gcccd.instructure.com/equation_images/Current%255C%253A%253D%255Cfrac%257B%255C%253AVoltage%257D%257BReq%257D)C u r r e n t = V o l t a g e R e q ![LaTeX: Power\:=\:Current\cdot Voltage](https://gcccd.instructure.com/equation_images/Power%255C%253A%253D%255C%253ACurrent%255Ccdot%2520Voltage)P o w e r = C u r r e n t ⋅ V o l t a g e 5. Run two cases of your code and report to the user the results of your calculations. The test cases are: Test Case 1: R1 = 120 Ohms, R2 = 230 Ohms and R3 = 250 Ohms. Voltage source = 10V. Test Case 2: R1 = 25 Ohms, R2 = 70 Ohms and R3 = 100 Ohms. Voltage source = 9V. Your communication should follow the format: “For resistances 100 Ohm, 200 Ohm and 300 Ohms, the equivalent resistance in series is 600 Ohms.” “For a 12V voltage source, the source current supplied is .02 Amps and the power supplied is .24 Watts.” “For resistances 100 Ohm, 200 Ohm and 300 Ohms, the equivalent resistance in parallel is 54.545454 Ohms.” “For a 12V voltage source, the source current supplied is .22 Amps and the power supplied is 2.64 Watts.”

In case you have a similar question and need it answered for you just click Order Now. At Academizzed.com we have all the most qualified academic writers and tutors, for all your assignments, essays, cases studies, discussion posts, project proposals, research papers, discussion posts, nursing assignments, admission essays, blog articles, and other forms of academic work.