Question

In: Computer Science

Suppose you have a voltage source V = 120V with an internal resistance RS of 50...

Suppose you have a voltage source V = 120V with an internal resistance RS of 50 ohms, supplying a load of resistance RL . Create a program that outputs a plot of the power PL supplied to the load as a function of the load resistance RL for RL = 1 to 100 ohms in steps of 1 ohm. The power PL is given by the equation PL = I 2RL where I = V/(RS + RL ). Write a function to calculate PL for the inputs RL , RS , V. Do not forget to label the axes with units and to create a title for the plot. · y-axis = Watts · x-axis = Ohms · Title = Load Power vs Load Resistance

I am confused on how to make this into a function in matlab. I have the code as a script but am struggling to turn it into a function

Solutions

Expert Solution

Question : To write the Matlab Function.

Solution : The Code Snippet as well as the necessary images are added below:

%Function to calculate Power supplied to the Load RL
% PL is the output and RL,RS,V are the inputs
function [PL] = Calculate(RL,RS,V) 

%Initializing Values
V=120;                           
RS = 50;

%Creating a vector to store PL values
res=zeros(1,100);

%Looping RL through 1 to 100
for RL = 1:100
    
    I = V/(RS+RL);    % Calculating I
    PL = I*2*RL;      % Calculating PL
    res(RL)=PL;       % Storing PL into the Vector
    fprintf('PL for %d = %f\n',RL,PL);     % Printing each Iteration using formatted display fprintf
                                      
end
%Plotting Values Using bar chart as the result is discrete
bar(res);

% Providing Title
title('Load Power Vs Load Resistance');

% Labelling x and y axis
xlabel('Ohms');
ylabel('Watts');

Output :

If " ans =160 " is not required then change the function as

" function [ ] = Calculate( RL,RS,V ) "  


Related Solutions

A hair dryer, rated at 1875 watts, operates on a 120V voltage source. What is its...
A hair dryer, rated at 1875 watts, operates on a 120V voltage source. What is its resistance? in Ohms How much current does it use? in A
For a resistance and capacitance in series with a voltage source, show that it is possible...
For a resistance and capacitance in series with a voltage source, show that it is possible to draw a phasor diagram for the current and all voltages from magnitude measurement of these quantities only.Ilustrate your answer graphieally
P = Power, V = Voltage, I = Current, and R = Resistance. Which of the...
P = Power, V = Voltage, I = Current, and R = Resistance. Which of the following relations is incorrect? Choices: V = I R P = V R P = VI I = V/R
A battery of ? = 2.10 V and internal resistance R = 0.600 ? is driving...
A battery of ? = 2.10 V and internal resistance R = 0.600 ? is driving a motor. The motor is lifting a 2.0 N mass at constant speed v = 0.50 m/s. Assuming no energy losses, find the current i in the circuit. (a) Enter the lower current. (b) Enter the higher current. (c) Find the potential difference V across the terminals of the motor for the lower current. (d) Find the potential difference V across the terminals of...
A damaged car battery with an emf of 11.4 V and an internal resistance of 0.01...
A damaged car battery with an emf of 11.4 V and an internal resistance of 0.01 ohms is connected to a load of 2.0 ohms. To help the battery, a second battery with an emf of 12.6 V and an internal resistance of 0.01 ohms is connected by jumper cables to the terminals of the first battery. Draw a diagram for the circuit. Find the current in each part of the circuit. Find the power delivered by the second battery.
A 36 V battery of negligible internal resistance is connected to a 47 kΩ and a...
A 36 V battery of negligible internal resistance is connected to a 47 kΩ and a 21 kΩ resistor in series. a). What reading will a voltmeter, of internal resistance 95 kΩ , give when used to measure the voltage across the first resistor? Express your answer using two significant figures. V47 kΩ= b). What is the percent inaccuracy due to meter resistance for each case? Express your answer using two significant figures. V not ideal−V ideal/V ideal= c). What...
A shunt motor has a supply voltage of 200 V and armature resistance of 3.6 Ω....
A shunt motor has a supply voltage of 200 V and armature resistance of 3.6 Ω. At certain torque the motor run at speed = 1200 R.P.M and take a current of 10 Amp from the supply and its field current is 0.5 Amp. Find starting torque, no-load speed, and the load torque when the current supplied by the supply is 5 Amp.
A 100 Hz AC voltage source, with a peak output of 170 V, is connected to...
A 100 Hz AC voltage source, with a peak output of 170 V, is connected to an inductor. If the rms current through the inductor is 1 A, what is the value of the inductor? 1. 1.9 H 2. 190 mH 3. 19 mH 4. 1.9 mH
The very high internal resistance of digital multimeters, in their voltage-measuring ranges, can be used to...
The very high internal resistance of digital multimeters, in their voltage-measuring ranges, can be used to measure extremely low currents (even though the DMM may not offer a low current range explicitly). Suppose, for example, you want to measure the small current that flows through a 1000 M ohm "leakage" resistance (that term is used to describe a small current that ideally should be absent entirely, for example through the insulation of an underground cable). You have available a standard...
A 2400-W oven is connected to a 240-V source. 1. What is the resistance of the...
A 2400-W oven is connected to a 240-V source. 1. What is the resistance of the oven? Express your answer to two significant figures and include the appropriate units. 2. How long will it take to bring 110 mL of 25 ∘C water to 100∘C assuming 65 % efficiency? The specific heat capacity of water is 4186 J/(kg⋅∘C). Express your answer using two significant figures. 3. How much will this cost at 12 cents/kWh? Express your answer using two significant...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT