Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

When comparing experimental data to a circuit or device model the measurement er

ID: 2085968 • Letter: W

Question

When comparing experimental data to a circuit or device model the measurement errors need to be taken into account when developing a mathematical model. Let x, and y, be pairs of measured data points. A function y fox) with some adjustable parameters is to be fit to the data. In the usual case of having more data point pairs than adjustable parameters it will not be possible to obtain an exact fit because measurement errors will make the equations inconsistent. Introducing an error term allows for a solution. The error or residual, is the difference between the function and the actual data, ry-y The least-squares method determines function parameters which minimize the total error, defined as the sum of the individual squared-error terms, E=E(r') A few curve fitting tools are listed below Matlab polynomial fitting function "polyfit": polynomials Matlab curve fitting toolbox "cftool": polynomials, exponential, Gaussian, power series, custom models Spreadshee: linear, logarithmic, exponential (plot the data using "X Y (scatter)", right-click on a data point, and select "insert trend line") For some functions a simple transformation can be performed which results in a linear relationship. For example the function y-kx2 can be transformed into a linear relationship by using x-sqrt(x) and y-kx. Similar operations can be performed on logarithmic and exponential relationships. Note that when this is done the the squared-error is also affected by the transformation, so this method changes the weighting of the error which may, or may not, be desirable. Exercise 1 -Battery: A battery can be modeled as a Thévenin equivalent source and the device it is powering can be modeled as a resistance. The primary parameters are voltage across the load and current delivered to the load. Because this source model is linear the voltage-current relationship graph is a straight line with the slope and axis-intercepts related to the model parameters, making curve-fitting easy to apply. To collect experimental data the battery voltage is measured using several different load resistances (which, of course, causes different load currents). Various factors, such as noise and non-ideal instruments, contribute to error in the collected data. One complicating factor is that, due to battery chemistry, when very little current is flowing the voltage-current relationship may not be linear. If the accuracy of the model at very low currents is unimportant this can be ignored by discarding those data point(s), otherwise a better (and more complicated) model is needed. Two 9-volt alkaline batteries were tested, one a nearly new battery and the other an older, used battery. The experimental data is listed in Table1 For each battery compute a linear least-square fit to the data and use the results to create a (a) circuit model for the battery. Draw the circuit model and provide component values. Plot voltage vs, current derived from the measured data (show only data points; do not connect the points)

Explanation / Answer

One example code in matlab of best line plot fit at different order is given below:

close all,
clear all,
clc,

X = [0.5, 1, 2, 4, 6];
Y = [1.4, 2.3, 4.4, 8.25, 12.45];

PolyOrder=1;
p = polyfit(X,Y,PolyOrder);
f = polyval(p,X);
figure, subplot(2,2,1);
plot(X,Y,'o',X,f,'-')
xlabel('---- X --->');
ylabel('---- Y --->');
str = strcat('Plot between Y and X at Poly Order = ',num2str(PolyOrder));
title(str);


PolyOrder=3;
p = polyfit(X,Y,PolyOrder);
f = polyval(p,X);

subplot(2,2,2);plot(X,Y,'o',X,f,'-')
xlabel('---- X --->');
ylabel('---- Y --->');
str = strcat('Plot between Y and X at Poly Order = ',num2str(PolyOrder));
title(str);

PolyOrder=4;
p = polyfit(X,Y,PolyOrder);
f = polyval(p,X);
subplot(2,2,3);plot(X,Y,'o',X,f,'-')
xlabel('---- X --->');
ylabel('---- Y --->');
str = strcat('Plot between Y and X at Poly Order = ',num2str(PolyOrder));
title(str);

PolyOrder=10;
p = polyfit(X,Y,PolyOrder);
f = polyval(p,X);
subplot(2,2,4);plot(X,Y,'o',X,f,'-')
xlabel('---- X --->');
ylabel('---- Y --->');
str = strcat('Plot between Y and X at Poly Order = ',num2str(PolyOrder));
title(str);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote