ZinsLab.org

Steven D. Zins' Physics Projects

User Tools

Site Tools


b:slope_compensation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
b:slope_compensation [2022/01/25 17:31]
sz
b:slope_compensation [2022/01/25 17:41] (current)
sz
Line 15: Line 15:
 Fourier analysis assumes that a signal repeats on some fixed cycle. If a signal does not do this, then FA cannot be used. At least without closing the cycle or the like. Fourier analysis assumes that a signal repeats on some fixed cycle. If a signal does not do this, then FA cannot be used. At least without closing the cycle or the like.
  
-This program shows that when the "c" parameter is removed from the model expression, then the "a" parameter  (on Sin[]) increases wildly. But when the "c" is present, the "a" parameter matches the "a1" in the data(xy) generation code+This program shows that when the "c" parameter is removed from the model expression, then the "a" parameter  (on Sin[]) increases wildly. But when the "c" is present, the "a" parameter matches the "a1" in the data(xy) generation code
 +This means that the linear term "c x" completely prevents the linear slope from affecting the true Sin[ ] component. 
  
 also to find out how to structure data for FindFit  also to find out how to structure data for FindFit 
Line 22: Line 23:
 <code mathematica> <code mathematica>
  
-Clear[x,y]; + 
-imax=20 +Clear[x,y,x1]; 
-x2=Table[i,{i,imax}];+imax=20; 
 +x2=Table[i/2.,{i,imax}];
 Print[" ",x2]; Print[" ",x2];
  
-a1=1; b1=25; c1=20+a1=1.01; b1=25; c1=10
-y= Table[a1 Sin[2 Pi .1 x1] + b1 + c1  x1,{x1,imax}]; +xy= Table[{x1/2.,a1 Sin[2 Pi .1 x1/2.]+ b1 + c1 x1/2.},{x1,imax}]; 
-Print[" ",y];+Print["xy  ",xy];
  
-ff=FindFit[y,a  Sin[2 Pi .1 x] + b + c  x,{a,b,c},x];+ff=FindFit[xy,a  Sin[2 Pi .1 x] + b + c  x,{a,b,c},x]; 
 +Print["angles ",Table[2 Pi .1 x1/2.,{x1,imax}]];
 Print["ff  ",ff]; Print["ff  ",ff];
- 
  
 x  {0.5,1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.,5.5,6.,6.5,7.,7.5,8.,8.5,9.,9.5,10.} x  {0.5,1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.,5.5,6.,6.5,7.,7.5,8.,8.5,9.,9.5,10.}
 +xy  {{0.5,30.3121},{1.,35.5937},{1.5,40.8171},{2.,45.9606},{2.5,51.01},{3.,55.9606},{3.5,60.8171},{4.,65.5937},{4.5,70.3121},{5.,75.},{5.5,79.6879},{6.,84.4063},{6.5,89.1829},{7.,94.0394},{7.5,98.99},{8.,104.039},{8.5,109.183},{9.,114.406},{9.5,119.688},{10.,125.}}
 +angles {0.314159,0.628319,0.942478,1.25664,1.5708,1.88496,2.19911,2.51327,2.82743,3.14159,3.45575,3.76991,4.08407,4.39823,4.71239,5.02655,5.34071,5.65487,5.96903,6.28319}
 +ff  {a->1.01,b->25.,c->10.}
  
-xy  {{0.5,30.3197},{1.,35.6081},{1.5,40.837},{2.,45.9839},{2.5,51.0346},{3.,55.9839},{3.5,60.837},{4.,65.6081},{4.5,70.3197},{5.,75.},{5.5,79.6803},{6.,84.3919},{6.5,89.163},{7.,94.0161},{7.5,98.9654},{8.,104.016},{8.5,109.163},{9.,114.392},{9.5,119.68},{10.,125.}} 
- 
-angles {0.314159,0.628319,0.942478,1.25664,1.5708,1.88496,2.19911,2.51327,2.82743,3.14159,3.45575,3.76991,4.08407,4.39823,4.71239,5.02655,5.34071,5.65487,5.96903,6.28319} 
  
-ff  {a->1.03457,b->25.,c->10.} 
 </code> </code>
  
b/slope_compensation.1643149861.txt.gz · Last modified: 2022/01/25 17:31 by sz