CURVE FITTING - Rajagiritech.ac.in

1y ago
11 Views
2 Downloads
607.79 KB
18 Pages
Last View : 15d ago
Last Download : 3m ago
Upload by : Kian Swinton
Transcription

CURVE FITTINGP.P.KrishnarajRSETBy P.P.Krishnaraj

CURVE FITTINGBEST FIT1. Large number of parameteri.e if polynomial is used ,order of polynomialincreases.2. Equation becomes big3. Regression in engineeringproblem4. Eg nusselt numbercorrelationsEXACT FIT/INTERPOLATION1. Number of parameter isless and you have absoluteconfidence in yourmeasurements.2. Passes through every point3. Eg property data,calibration data.P.P.Krishnaraj RSET

Curve fitting by method of least squares forstraight lineY a bXƩYi na bƩXi2ƩXiYi aƩXi bƩXiP.P.Krishnaraj RSET

Q)Find a straight line fit by method of least square to following dataXYXYX211414122754434012094552201656834025ƩX 15ƩY 204ƩXY 748ƩX2 55P.P.Krishnaraj RSETY a bXƩYi na bƩXiƩXiYi aƩXi bƩXi2n 5204 5a 15b748 15a 55b

Curve fitting by method of least squares forparabola2Y aX bX c2ƩYi aƩXi bƩXi nc32ƩXiYi aƩXi bƩXi cƩXi2432ƩXi Yi aƩXi bƩXi cƩXiP.P.Krishnaraj RSET

Curve fitting by method of least squares forexponential curvebXY aeTaking log on both sideslog10Y log10a bXlog10eY A BXƩYi nA BƩXi2ƩXiYi AƩXi BƩXiP.P.Krishnaraj RSET

Geometric curvesy axblog10y log10a blog10xY A bXƩYi nA bƩXiƩXiYi AƩXi bƩXi2y abxlog10y log10a xlog10bY A xBƩYi nA BƩxiƩxiYi AƩxi bƩxi2Y ax b/xxy ax2 bƩxy aƩx2 nbƩ(y/x) na bƩ(1/x2)P.P.Krishnaraj RSET

Program for curve fitting by method ofleast squares for straight lineY a bXƩYi na bƩXi2ƩXiYi aƩXi bƩXixƩx yƩy xy2xƩxy 2Ʃx P.P.Krishnaraj RSET

for(i 0;i n;i )#include stdio.h {#include conio.h xsum xsum x[i];/*calculates Ʃxi*/#include math.h ysum ysum y[i];/*calculates Ʃyi*/#define MX 10x2sum x2sum pow(x[i],2);/*calculates Ʃxi2*/int main()xysum xysum x[i]y[i];/*calculates Ʃxiyi*/{}int i,j,k,n;𝑛.𝑥𝑦𝑠𝑢𝑚 𝑥𝑠𝑢𝑚 𝑦𝑠𝑢𝑚B ( 2);cout “enter the x axis values”;𝑛.𝑥 𝑠𝑢𝑚 𝑥𝑠𝑢𝑚 𝑥𝑠𝑢𝑚for(i 0;i n;i )𝑥2𝑠𝑢𝑚.𝑦𝑠𝑢𝑚 𝑥𝑠𝑢𝑚 𝑥𝑦𝑠𝑢𝑚A ();{𝑛.𝑥2𝑠𝑢𝑚 𝑥𝑠𝑢𝑚 𝑥𝑠𝑢𝑚cout “the values of a and b are” a b endl;cin x[i];cout “the required linear relation is”;cout “enter the y axis values”;cout “y “ A “ ” B “x”” endl;for(i 0;i n;i )getch();{}cin y[i]; }float xsum 0,x2sum 0,ysum 0,xysum 0;P.P.Krishnaraj RSET

Program for curve fitting by method ofleast squares for exponential curvey aebxTaking log on both sideslog10y log10a bxlog10eY A BxƩYi nA BƩxiƩXiYi AƩXi BƩxi2xyY logyƩx Ʃy P.P.Krishnaraj RSETƩY xY2xƩxY 2Ʃx

#include stdio.h #include conio.h #include math.h #define MX 10int main(){int i,number;float xvalue[MX],yvalue[MX],sumx 0;sumlogy 0;float productxlogy[MX],sumxlogy 0,square[MX],sumx2 0;float denominator,a,B,A;Cout “how many values of x “;Cin number;For(i 0;i number;i ){Cin xvalue[i]; }P.P.Krishnaraj RSET

cout “enter y values”:for(i 0;i n:i ){cin yvalue[i];}for(i 0;i number;i ){sumx sumx xvalue[i];}for(i 0;i number;i ){sumlogy sumlogy log(yvalue[i]);}for(i 0;i number;i ){productxlogy[i] xvalue[i]*log(yvalue[i]);sumxlogy sumxlogy productxlogy[i];}for(i 0;i number;i ){square[i] xvalue[i]*xvalue[i];sumx2 sumx2 square[i];}denominator 𝑛𝑢𝑚𝑏𝑒𝑟 𝑠𝑢𝑚𝑥2 𝑠𝑢𝑚𝑥 𝑠𝑢𝑚𝑥A B 𝑠𝑢𝑚𝑙𝑜𝑔𝑦 𝑠𝑢𝑚𝑥2 (𝑠𝑢𝑚𝑥 �� 𝑠𝑢𝑚𝑥𝑙𝑜𝑔𝑦 (𝑠𝑢𝑚𝑥 𝑖𝑛𝑎𝑡𝑜𝑟A exp(A); /*i.e antilog of A */B B/log10e;}P.P.Krishnaraj RSET

Program for curve fitting by method ofleast square for geometric curvey axblog10y log10a blog10xY A bXƩYi nA bƩXiƩXiYi AƩXi bƩXi2XyƩX Ʃlogx Ʃy Y logyƩY Ʃlogy P.P.Krishnaraj RSETXYƩXY Ʃlogx*logy X2ƩX2 2Ʃlogx

#include stdio.h #include conio.h #include math.h #define MX 10int main(){int i,number;float sumlogx 0,sumlogy 0,xvalue[MX],yvalue[MX];float productlogxlogy[MX],sumlogxlogy 0,square[MX],sumx2 0;float denominator,a,B,A;Cout “how many values of x “;Cin number;For(i 0;i number;i ){P.P.Krishnaraj RSETCin xvalue[i]; }

cout “enter y values”:for(i 0;i number;i )for(i 0;i n:i ){{square[i] log(xvalue[i])*log(xvalue[i]);cin yvalue[i];}sumx2 sumx2 square[i];for(i 0;i number;i )}{denominator 𝑛𝑢𝑚𝑏𝑒𝑟 𝑠𝑢𝑚𝑥2 sumlogx sumlogx log(xvalue[i]);𝑠𝑢𝑚𝑙𝑜𝑔𝑥 𝑠𝑢𝑚𝑙𝑜𝑔𝑥}for(i 0;i number;i )𝑠𝑢𝑚𝑙𝑜𝑔𝑦 𝑠𝑢𝑚𝑙𝑜𝑔𝑥2 (𝑠𝑢𝑚𝑙𝑜𝑔𝑥 𝑠𝑢𝑚𝑙𝑜𝑔𝑥𝑙𝑜𝑔𝑦)A 𝑢𝑚𝑏𝑒𝑟 𝑠𝑢𝑚𝑙𝑜𝑔𝑥𝑙𝑜𝑔𝑦 (𝑠𝑢𝑚𝑙𝑜𝑔𝑥 𝑠𝑢𝑚𝑙𝑜𝑔𝑦)sumlogy sumlogy log(yvalue[i]);B ;𝑑𝑒𝑛𝑜𝑚𝑖𝑛𝑎𝑡𝑜𝑟}a exp(A);}for(i 0;i number;i ){productlogxlogy[i] log(xvalue[i])*log(yvalue[i]);sumlogxlogy sumlogxlogy productlogxlogy[i];P.P.Krishnaraj RSET}

A program to obtain the solution to laplaceequation as per specified boundary conditions.P.P.Krishnaraj RSET

#include iostream.h #include math.h int main(){int I,j,k;float u[5][5],v[5][5];float relerr,maxerr 0,err;cout “give the accuracy needed”;cin err;cout “give the boundary condtions at x 0 and y 0”;cin u[0][0];for(i 1;i 4;i ){u[0][i] u[0][0];}P.P.Krishnaraj RSETfor(i 1;i 4;i ){u[i][0] u[0][0];}for(i 1;i 4;i ){u[i][0] u[0][0];}for(i 1;i 4;i ){cin u[4][i];}for(i 0;i 4;i ){cin u[i][4];}

u[2][2] (u[0][0] u[4][4] u[0][4] u[4][0])/4;u[1][1] (u[0][0] u[2][2] u[2][0] u[0][2])/4;u[3][1] (u[4][2] u[2][0] u[4][0] u[2][2])/4;u[3][3] (u[4][4] u[2][2] u[4][2] u[2][4])/4;u[1][3] (u[2][4] u[0][2] u[2][2] u[0][4])/4;u[2][1] (u[1][1] u[3][1] u[2][2] u[2][0])/4;u[3][2] (u[3][3] u[3][1] u[4][2] u[2][2])/4;u[1][2] (u[1][3] u[1][1] u[0][2] u[2][2])/4;u[2][3] (u[2][4] u[2][2] u[1][3] u[3][3])/4;for(k 1;k 100;k ){ cout k;maxerr 0.0;for(j 1;j 4;j ){for(i 1;i 4;i ){v[i][j] (u[i-1][j] u[i 1][j] u[i][j-1] u[i][j 1])/4;relerr fabs()v[i][j]-u[i][j])/u[i][j];If(relerr maxerr)maxerr relerr;}}if(maxerr relerr){cout “converged solution is obtained by Jacobimethod”;break;}for(j 1;j 4;j )for(i 1;i 4;i )u[i][j] v[i][j];}return 0;}P.P.Krishnaraj RSET

Curve fitting by method of least squares for parabola Y aX2 bX c ƩY i aƩX i 2 bƩX i nc ƩX i Y i aƩX i 3 bƩX i 2 cƩX i ƩX i 2Y i aƩX i 4 bƩX i 3 cƩX i 2 P.P.Krishnaraj RSET. Curve fitting by method of least squares for exponential curve Y aebX Taking log on both sides log 10 Y log 10 a bXlog 10 e Y A BX ƩY i nA BƩX i ƩX i Y i AƩX

Related Documents:

behringer ultra-curve pro dsp 24 a/d- d/a dsp ultra-curve pro ultra- curve pro 1.1 behringer ultra-curve pro 24 ad/da 24 dsp ultra-curve pro dsp8024 smd (surface mounted device) iso9000 ultra-curve pro 1.2 ultra-curve pro ultra-curve pro 19 2u 10 ultra-curve pro ultra-curve pro iec . 7 ultra-curve pro dsp8024 .

Part 5 - CURVE FITTING Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches for curve fitting: Least Squares regression: Data exhibit a significant degree of scatter. The strategy is to derive a single curve that represents the general trend of the data .

polynomial curve fitting. Polynomials are one of the most The Polynomial Curve Fitting uses the method of least squares when fitting data. The fitting process requires a model that relates the response data to the predictor data with one or more coefficients. The result of the fitting process is an estimate of

I. METHODS OF POLYNOMIAL CURVE-FITTING 1 By Use of Linear Equations By the Formula of Lagrange By Newton's Formula Curve Fitting by Spiine Functions I I. METHOD OF LEAST SQUARES 24 Polynomials of Least Squares Least Squares Polynomial Approximation with Restra i nts III. A METHOD OF SURFACE FITTING 37 Bicubic Spline Functions

Keywords Curve fitting · Surface fitting · Discrete polynomial curve · Discrete polynomial surface · Local optimal · Outliers 1 Introduction . The method of least squares is most commonly used for model fitting. This method estimates model parameters by minimizing the sum of squared residuals from all data, where

For best fitting theory curve (red curve) P(y1,.yN;a) becomes maximum! Use logarithm of product, get a sum and maximize sum: ln 2 ( ; ) 2 1 ln ( ,., ; ) 1 1 2 1 i N N i i i N y f x a P y y a OR minimize χ2with: Principle of least squares!!! Curve fitting - Least squares Principle of least squares!!! (Χ2 minimization)

regression curve fitting a. You will have to estimate your parameters from your curve to have starting values for your curve fitting function 3. Once you have parameters for your curves compare models with AIC 4. Plot the model with the lowest AIC on your point data to visualize fit Non-linear regression curve fitting in R:

American Revolution Wax Museum Project Overview You will become an expert on one historical figure who played a significant role in the American Revolution. For this individual, you complete the following tasks: 1. Notes: Use at least 3 sources to research and take notes about the individualʼs life, views, and impact. At least one of