using what you have learnt in the last several labs, it is desired to make a plo
ID: 3936724 • Letter: U
Question
using what you have learnt in the last several labs, it is desired to make a plot of the following equation P= RL.*( 10./RL + 20).^2 PROBLEM 1 (30 points): Using what you have leaned in the last several labs it is desired to make a plot of the following equation: 10 R +20 The equation is derived from the circuit shown below The Y axis variable P is power of the resistor Ri which is transferred from a battery modeled as a voltage source Vn equal to 10 V also having and internal heating loss modeled by Re-20 Ohms It's desired to plot the power P on the Yans in terms of the load resistance Ri on the X axis for the purpose of estimating the value of R: which results in a maximum value of P. Assume the input Ri, changes from 0 to 40 Ohms with a step size of 0.1 Ohms Create the plot described above and add a title, the appropriate x and y labels and lasty activate a grid to aid in reading the plot PROBLEM 2 (30 points) Next, use a FOR loop starting at R-0 having an ghmic step size of 0 001 ohms to find the value of Ri which makes power P maximum. You will need to inolude an IF statement in your code to determine when the maximum value of P is reached and stop the FOR loop using the BREAK command Lasty, use FPRINTF Command to prnt out the solution found for the value of Ri and the corresponding vatuo of load powar P appropriaeExplanation / Answer
Rl = 0:0.1:40;
P = Rl.*(10.0./(Rl + 20.0)).^2;
figure
plot (Rl, P);
title('Plot of Rl vs P');
xlabel('Rl');
ylabel('P');
grid on
value = 0;
for rl=0:0.001:40
prev_value = value;
value = rl*(10.0/(rl + 20.0))^2;
if value<prev_value
max = prev_value;
break;
end
end
fprintf('Maximum value: %f ', max);
BOS = [2.67 1.00 1.21 3.09 3.43 4.71 3.88 3.08 4.10 2.62 1.01 5.93];
SEA = [6.83 3.63 7.20 2.68 2.05 2.96 1.04 0.00 0.03 6.71 8.28 6.85];
total = 0;
num_months_bos = 0;
num_months_sea = 0;
bos_lower_sea_months = [];
bos_lower_sea = 0;
for i=1:1:12
total = total + BOS(i) + SEA(i);
end
av = total/12.0;
for i=1:1:12
if (BOS(i) > av)
num_months_bos = num_months_bos + 1;
end
if (SEA(i) > av)
num_months_sea = num_months_sea + 1;
end
if (BOS(i) < SEA(i))
bos_lower_sea = bos_lower_sea + 1;
bos_lower_sea_months(end+1) = i;
end
end
fprintf('Total precipitation: %f ', total);
fprintf('Number of months precipitaion in BOS greater than average: %f ', num_months_bos);
fprintf('Number of months precipitaion in SEA greater than average: %f ', num_months_sea);
fprintf('Number of months precipitaion in BOS lower than in SEA: %f ', bos_lower_sea);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.