Task 2 The relationship between the voltage applied across a resistor and the current flowing through the resistor is given by Ohm's law, which can be expressed in the following mathematical form: V = I× R Where: • V is the voltage across the resistor (volts), V R • I is the current flowing through the resistor (amperes), • R is the resistance (ohms). The following table gives data for the current flowing through a resistor: S. No. Current 1 2 3 4 5 6 7 8 9 10 0.1 0.2 0.5 1.0 1.5 2.0 3.0 5.0 7.5 10.0 (Amperes) a) Write a script that will prompt the user for the value of the resistance and determine the voltage across the resistor for each current in the table. The script will print the result for each current in the following tabular format: Example: S.No. Current (Amperes) Voltage (Volts) 1. 0.1 1.0 2. 0.5 2.0 . 10. 10.0 100.0 b) Plot Voltage vs Current for the given resistance. c) Prompt the user a second time for a different value of resistance and plot the voltage vs current in the same graph as in part (b) for both resistances. (Hint: Use the subplot command and don't forget to label your graphs)

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
icon
Related questions
Question
MATLAB Please don't use AI provide screen shot for output and code Quickly
Task 2
The relationship between the voltage applied across a resistor and the current flowing through
the resistor is given by Ohm's law, which can be expressed in the following mathematical form:
V = I× R
Where:
•
V is the voltage across the resistor (volts),
V
R
•
I is the current flowing through the resistor (amperes),
•
R is the resistance (ohms).
The following table gives data for the current flowing through a resistor:
S. No.
Current
1
2
3
4
5
6
7
8
9
10
0.1
0.2
0.5
1.0
1.5
2.0
3.0
5.0
7.5
10.0
(Amperes)
a) Write a script that will prompt the user for the value of the resistance and determine the
voltage across the resistor for each current in the table. The script will print the result
for each current in the following tabular format:
Example:
S.No.
Current (Amperes)
Voltage (Volts)
1.
0.1
1.0
2.
0.5
2.0
.
10.
10.0
100.0
b) Plot Voltage vs Current for the given resistance.
c) Prompt the user a second time for a different value of resistance and plot the voltage vs
current in the same graph as in part (b) for both resistances.
(Hint: Use the subplot command and don't forget to label your graphs)
Transcribed Image Text:Task 2 The relationship between the voltage applied across a resistor and the current flowing through the resistor is given by Ohm's law, which can be expressed in the following mathematical form: V = I× R Where: • V is the voltage across the resistor (volts), V R • I is the current flowing through the resistor (amperes), • R is the resistance (ohms). The following table gives data for the current flowing through a resistor: S. No. Current 1 2 3 4 5 6 7 8 9 10 0.1 0.2 0.5 1.0 1.5 2.0 3.0 5.0 7.5 10.0 (Amperes) a) Write a script that will prompt the user for the value of the resistance and determine the voltage across the resistor for each current in the table. The script will print the result for each current in the following tabular format: Example: S.No. Current (Amperes) Voltage (Volts) 1. 0.1 1.0 2. 0.5 2.0 . 10. 10.0 100.0 b) Plot Voltage vs Current for the given resistance. c) Prompt the user a second time for a different value of resistance and plot the voltage vs current in the same graph as in part (b) for both resistances. (Hint: Use the subplot command and don't forget to label your graphs)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage