PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

146 Practical MATLAB® Applications for Engineers


>> W1BTU=W1J/1055, W2BTU=W2J/1055
W1 _ BTU =
0.0474
W2 _ BTU =
0.0152
>> W1 _ ftlbf =W1J*0.737,W2 _ ft1bf=W2J*0.737
W1 _ ft1bf =
36.8500
W2 _ ft1bf =
11.7920
>> W1 _ Kwh=W1J/3.6*10^-6, W2 _ Kwh=W2J/3.6*10^-6
W1 _ Kwh =
1.3889e-005
W2 _ Kwh =
4.4444e-006

Example 2.6
Create the script fi le linearity that verifi es the linear relation between the current
and voltage in a resistive circuit (Ohm’s law), and the nonlinearity of its power for
the circuit shown in Figure 2.43, where the applied voltage V 0 varies over the range
10 V ≤ V 0 ≤ 1000 V in linear increments of 10 V by obtaining the following plots:


  1. V 0 versus I

  2. V 0 versus PR (power dissipated by R = 1 kΩ)


FIGURE 2.43
Network of Example 2.6.

1 kΩ
V 0

l


+

MATLAB Solution
%Script file: linearity
R=1.0e3;
V=10:10:1000;
I=V./R;
P=I.*V;
subplot(2,1,1)
plot (V,I*1000)
title(‘Current vs. Voltage’)
xlabel(‘Voltage (Volts)’)
ylabel(‘Current (mA)’)
subplot(2,1,2)
plot (V,P)
title(‘Power vs. Voltage’)
xlabel(‘Voltage (Volts)’)
ylabel(‘Power (watts)’)

The script fi le linearity is executed and the results are shown in Figure 2.44.
Free download pdf