Chapter 4 - Applications of Linear Systems and Matrices

Section 4.2 -  Applications of Linear Systems to Curve Fitting

Example 4.2.1

P={-21,15};Q={9,-4};T={37,26};

PtsPlot=Graphics[{PointSize[0.05],Blue,Point[{P,Q,T}]},Axes->True];

TxtPlot=Graphics[{Black,Text["P",{-21,19}],Text["Q",{6,-2}],Text["T",{37,20}]}];

EqnParabola=y==a (x^2)+b x+c;

Eqn1=EqnParabola/.{x->P[[1]],y->P[[2]]}

Eqn2=EqnParabola/.{x->Q[[1]],y->Q[[2]]}

Eqn3=EqnParabola/.{x->T[[1]],y->T[[2]]}

Solns=Solve[{Eqn1,Eqn2,Eqn3},{a,b,c}]

Parabola=(EqnParabola/.Solns[[1]])[[2]]

ParabolaPlot=Plot[Parabola,{x,-25,40},PlotStyle->{{Red,Thickness[0.01]}}];

Show[ParabolaPlot,TxtPlot,PtsPlot]

Example 4.2.2

DataSet={{0,2},{.2,7},{.4,15},{.6,26},{.8,47},{1.0,63},{1.2,72}};

DataPlot=Graphics[{PointSize[0.03],Blue,Point[DataSet]},Axes->True];

ExpForm[x_]:=a+b (E^(-x))+ c (E^x) + d (E^(-2x)) + e (E^(2 x)) + f (E^(-3 x))+ g (E^(3 x));

Solns=Solve[ExpForm[DataSet[[All,1]]]==DataSet[[All,2]],{a,b,c,d,e,f,g}]

SolnFunc=(ExpForm[x]/.Solns)[[1]]

ExpPlot=Plot[SolnFunc,{x,-0.05,1.25},PlotStyle->{{Red,Thickness[0.01]}}];

Show[ExpPlot,DataPlot]

ModExpSoln=SolnFunc/.{x->x/100}

ExpPlotMod=Plot[ModExpSoln,{x,0,120},PlotStyle->{{Red,Thickness[0.01]}}];

DataSetMod=Table[{100 DataSet[[i,1]],DataSet[[i,2]]},{i,1,Length[DataSet]}]

DataPlotMod=Graphics[{PointSize[0.03],Blue,Point[DataSetMod]},Axes->True];

Show[ExpPlotMod,DataPlotMod]