You are on page 1of 2

Maryam hayder neama

Linearize output data H.W

theta( input) resistance ( output)

0 0

16.5 25

33 50

49.5 75

66 100

Code in matlap
Theta = [0, 16.5, 33, 49.5, 66];
Y = [0, 25, 50, 75, 100];

figure;
plot(Theta, Y, '*');
xlabel('Theta');
ylabel('Resistance');

degree = 1;
coefficients = polyfit(Theta, Y, degree);
linear_eq = polyval(coefficients, Theta);

figure;
plot(Theta, Y, '*', Theta, linear_eq, '-');
xlabel('Theta');
ylabel('Resistance');
legend('Original Data', 'Linear Fit');

disp('Linear Equation Coefficients:');


disp(coefficients);

Input and output plot

Linearize input and output plot

You might also like