0% found this document useful (0 votes)
12 views6 pages

Approximation Report

This document describes performing approximation methods using Matlab on two examples. The first example fits a linear regression line to temperature and resistance data to compute temperature coefficients. The second computes relative error from a data set using linear least squares approximation.

Uploaded by

MaRsHall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Approximation Report

This document describes performing approximation methods using Matlab on two examples. The first example fits a linear regression line to temperature and resistance data to compute temperature coefficients. The second computes relative error from a data set using linear least squares approximation.

Uploaded by

MaRsHall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Numerical Methods Laboratory

Lab 5:
Approximation

Edgar Abasov

Objective of current report is to perform approximation methods using Matlab software and language on a
few examples.
1) First example of wire coil represents dependence temperature and resistance where we should
compute values: temperature co-efficient of Resistance.
• Firstly, here performed converting given input data into working form.

(Celsius-->Kelvins, Ohms to milliohms)

• Dependence of variables is shown in the graph Above.

• Following step is to compute equation roots using Matlab’s already predefined functions polyfit
and polyval. As it shown (Above and right graph) linearity of input data is obvious and
approximation regression line location is right.

• Also, we got roots: 0.2235 and 133.2177 which are temperature co-efficient of Resistance a and
b in equation at the task paper.

Source code for task1):


% Input data (temperature in celsius wire coil )

T = [-85.02,-33.36,-9.99,32.88,1000.00,218.00,356.58,444.50,630.50];

T = T+273.15; % converting to kelvins

%disp(T);

% Resistance in ohms

R = [0.1000, 0.1335, 0.1464, 0.1737, 0.2155, 0.2810, 0.3599, 0.4077, 0.5017];

R = R*1000; % converting to miliohms

p = polyfit(T,R,1);

disp(p)

plot(p)

T1 = T;

R1 = polyval(p,T1);

figure

plot(T,R,'o')

hold on

plot(T1,R1)

hold off

2) Second task is to count relative error from input data set. Also, implementation performed using
Matlab.
• Input data computed throught the equation (X'*X)*-1*X'*y;
• Relative error computed using classic approximation formula

Result are:
Source code for task2:
X = [1 0; 1 2.5;1 5.5; 1 8.5; 1 11];

disp(X);

n=5;

relative_error=zeros(n);

y = [0.03; 0.9; 2.8; 4.7; 6.3];

disp(y);

p = (X'*X)*-1*X'*y;

disp(p);

relative_error=[];

y1 = X*p;

sum = 0;

for i=1:n

relative_error(i)=(1-y1(i)/y(i))*100;

fprintf('% %',i,relative_error(i));

sum=sum+abs(relative_error(i));

end

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy