| Author | 
                
                  Topic   | 
                
                
                 
                 
                 
                 
                 
                                 | 
               
              
                | 
                 rvasan 
                 
                
                USA 
                2 Posts  | 
                
                  
                    
                      
                       Posted - 03/16/2017 :  1:39:17 PM
                        
                        
                        
                        
                        
                      
  | 
                     
                    
                       Origin Ver. and Service Release (Select Help-->About Origin): Origin 8 pro SR0 Ver. 8.0724  Operating System:Win7
  Hello,
  I'm trying to use Origin to perform a deconvolution fitting of fluorescence decay curves with the instrument response function.There are no built in functions in origin for this application. I found this tutorial in Origin website  http://www.originlab.com/doc/Tutorials/Fitting-Convolution  with a program to perform the operation.  Unfortunately, when I tried to run the program I get following compiling error Error, Member function  Project::GetNLFitContext  not defined or does not have matching prototype. So i tried to find this function in my workspace, but could not find it. Could anyone help me with this.
  Thanks
  Ramesh Vasan | 
                     
                   
                 | 
               
              
                | 
                 arstern 
                 
                
                USA 
                237 Posts  | 
                
                  
                    
                      
                       Posted - 03/16/2017 :  3:53:41 PM
                        
                        
                        
                        
                        
                      
  | 
                     
                    
                       Hi Ramash, 
  The error may be occurring when you create the Fitting Function from the Fitting Function Organizer dialog box. 
  Some things to note: Make sure when you you select the code builder next to the Function box that the box is blank. Make sure to input the parameters and variables before selecting the code builder. 
  As well, when you input the text into the code builder that is shown in the tutorial. There are few things to edit and keep. 
  Lines 1 - 6 should be changed to read:  #pragma warning(error : 15618) #include <origin.h> // Header files need to be included #include <ONLSF.H> #include <fft_utils.h>
  Scroll down in the code builder to where it reads //Beginning of editable part 
  After this line Copy and paste from tutorial:
  NLFitContext *pCtxt = Project.GetNLFitContext();         Worksheet wks;         DataRange dr;         int c1,c2;         dr = pCtxt->GetSourceDataRange(); //Get the source data range         dr.GetRange(wks, c1, c2);  //Get the source data worksheet 	if ( pCtxt ) 	{	 		// Vector for the output signal in each iteration. 		static vector vSignal; 		// If parameters were updated, we will recalculate the convolution result. 		BOOL bIsNewParamValues = pCtxt->IsNewParamValues(); 		if ( bIsNewParamValues ) 		{ 			// Read sampling and response data from worksheet. 			Dataset dsSampling(wks, 0); 			Dataset dsResponse(wks, 2); 			int iSize = dsSampling.GetSize();   			vector vResponse, vSample;   			vResponse = dsResponse; 			vSample = dsSampling;   			vSignal.SetSize(iSize); 			vResponse.SetSize(iSize); 			vSample.SetSize(iSize);   			// Compute the exponential decay curve 			vSignal = A * exp( -t*vSample ); 			// Perform convolution 			int iRet = fft_fft_convolution(iSize, vSignal, vResponse);                         //Correct the convolution by multiplying the sampling interval                         vSignal = (vSample[1]-vSample[0])*vSignal;     		}   		NLSFCURRINFO    stCurrInfo; 		pCtxt->GetFitCurrInfo(&stCurrInfo); 		// Get the data index for the iteration 		int nCurrentIndex = stCurrInfo.nCurrDataIndex; 		// Get the evaluated y value 		y = vSignal[nCurrentIndex] + y0; 		// For compile the function, since we haven't use x here. 		x; 	}
 
  Select compile before closing the code builder. Does the compile work? 
  --Aviel Stern OriginLab
 
  | 
                     
                    
                       Edited by - arstern on 03/16/2017  3:54:42 PM | 
                     
                    
                        | 
                     
                   
                 | 
               
              
                | 
                 rvasan 
                 
                
                USA 
                2 Posts  | 
                
                  
                    
                      
                       Posted - 03/16/2017 :  4:31:14 PM
                        
                        
                        
                        
                        
                      
  | 
                     
                    
                       I tried to compile it and I'm getting a similar error. I made sure the fit parameters, independent variable and dependent variables are declared correctly. Attached is the screen shot
 
 
  
 
  Ramesh Vasan | 
                     
                    
                        | 
                     
                   
                 | 
               
              
                | 
                 arstern 
                 
                
                USA 
                237 Posts  | 
                
                  
                    
                      
                       Posted - 03/16/2017 :  5:16:03 PM
                        
                        
                        
                        
                        
                      
  | 
                     
                    
                       Hi Ramesh, 
  I apologize for not noticing this before. To perform convolution while fitting you are required to a have a minimum version of Origin 2016 SRO. I recommend updating your version of Origin as there are many new features and apps that can be utilized. 
  --Aviel Stern  OriginLab | 
                     
                    
                        | 
                     
                   
                 | 
               
              
                |   | 
                
                  Topic   | 
                
                
                 
                 
                 
                 
                 
                 | 
               
             
           | 
         
       
     |