| Author | 
                
                  Topic   | 
                
                
                 
                 
                 
                 
                 
                                 | 
               
              
                | 
                 bernie426 
                 
                
                USA 
                1 Posts  | 
                
                  
                    
                      
                       Posted - 03/01/2013 :  6:29:10 PM
                        
                        
                        
                        
                        
                      
  | 
                     
                    
                       Origin Ver. and Service Release (Select Help-->About Origin):  Operating System:
  I have an equation to fit with my experiment data points,but the curve fitting always shows magnitude lower at the y-axis. Could any expert help me out? F can be any constant larger than 0 and the only factor to be extract is n.
  Here is my code: 	x*=pi/180.0;// convert x to radian  (x is independent  variable) 	t*=pi/180.0;// convert t to radian (t is know value, 20 degree) 	double r; 	r=z/(cos(t));//z set to 910 	double u,v; 	u=(r*cos(x))+((r*sin(x))*tan(x+t)); 	v=(r*cos(t))*(1/(cos(x+t))); 	if(x>=0) 	y=F*(n+1)*(1/(2*pi*u^2))*((cos(x))^n); 	else if(x<=0) 		y=F*(n+1)*(1/(2*pi*v^2))*((cos(x))^n)
  The experiment data points are x    y -12.54  770.5519 -8.18  768.7524 -3.92  787.47 0.19   774.24 4.13   726.31 7.78   675.0 11.41  637.15 14.71  569.86 17.8   512.13 20.68  465.64 23.34  420.52 25.82  355.25 28.11  314.7 30.22  274.03 32.19  247.61 34.00  202.18 35.69  187.7 37.13  170.9  
  Thanks 	 | 
                     
                    
                       Edited by - bernie426 on 03/01/2013  6:50:45 PM | 
                     
                   
                 | 
               
              
                | 
                 Shirley_GZ 
                 
                
                China 
                 Posts  | 
                
                  
                    
                      
                       Posted - 03/04/2013 :  02:44:04 AM
                        
                        
                        
                        
                        
                      
  | 
                     
                    
                       Hi Bernie, I defined the fitting function as below:
  	double x1=x*pi/180; 	double t=20; 	double z=910; 	t*=pi/180.0;// convert t to radian  	double r; 	r=z/(cos(t)); 	double u,v; 	u=(r*cos(x1))+((r*sin(x1))*tan(x1+t)); 	v=(r*cos(t))*(1/(cos(x1+t))); 	if(x1>=0) 	y=F*(n+1)*(1/(2*pi*u^2))*((cos(x1))^n); 	else if(x1<=0) 	y=F*(n+1)*(1/(2*pi*v^2))*((cos(x1))^n)
  And then, set the parameter n as 2 and fix it, set parameter F as 1E9. Click Fit button to do fitting.
  It is worthy to mention that in your code, after you simplify the equation, u is equal to v. so, for x>=0 and x<=0, the y equations are same.
 
  Originlab Technical Service Team | 
                     
                    
                       Edited by - Shirley_GZ on 03/04/2013  02:47:19 AM | 
                     
                    
                        | 
                     
                   
                 | 
               
              
                | 
                 cc261 
                 
                
                22 Posts  | 
                
                  
                    
                      
                       Posted - 03/06/2013 :  11:07:00 PM
                        
                        
                        
                        
                        
                      
  | 
                     
                    
                       see the results below:
  f	1715573154.26265 n	1.61268335005249 | 
                     
                    
                        | 
                     
                   
                 | 
               
              
                |   | 
                
                  Topic   | 
                
                
                 
                 
                 
                 
                 
                 | 
               
             
           | 
         
       
     |