Grace/C3/Fit-an-Exponential-Decay-Curve/English-timed
From Script | Spoken-Tutorial
Time | Narration |
00:01 | Welcome to the tutorial on Fit an exponential Decay Curve. |
00:07 | In this tutorial, we will learn to, Add multiple graph panels to the canvas |
00:14 | Remove dataset from the graph panel and |
00:19 | Fit a given set of data points with non-linear regression method. |
00:26 | To record this tutorial, I am using
Ubuntu Linux 16.04 OS |
00:35 | Grace 5.1.25 |
00:41 | Gedit 3.18.3 |
00:46 | To follow this tutorial, Learner must be familiar with the Grace interface. |
00:53 | For pre-requisite tutorials, please visit this site. |
00:58 | Two input files used in this tutorial are provided in the code files link. |
01:05 | Please download and extract the files.
|
01:09 | I have downloaded and saved them on my Desktop. |
01:14 | I have opened the Grace interface. |
01:18 | Click on File, Open to open a project. |
01:22 | Open the regression.agr project file from the Desktop directory. |
01:29 | A straight line graph is plotted on this plot window. |
01:34 | Let's add another graph panel to the canvas. |
01:38 | Go to the Edit menu, select Arrange graphs option. |
01:44 | The Arrange graphs window opens. |
01:48 | Under Matrix, in the Cols drop-down increase the number of columns to 2. |
01:55 | Click on Apply and then on click Close. |
01:59 | Notice that one more graph panel is added to the white canvas. |
02:05 | Notice that the graph panels are now elongated. |
02:10 | I will resize the graph panels to two squares as seen on the screen. |
02:17 | I will also reposition the legends in the canvas. |
02:22 | To select a graph, click on it. |
02:25 | The selected graph is highlighted with the black squares on the corners. |
02:31 | Select the newly added graph panel. |
02:35 | Go to Data, Import, ASCII in the menu. |
02:41 | Select the file, exponential.txt from Desktop directory. |
02:47 | Load the data as an XY dataset. |
02:51 | Click on Ok to plot the graph. |
02:55 | Then, click on Cancel to close the window. |
02:59 | From a visual inspection, the data points follow an exponential decay curve. |
03:06 | Double click on the curve to open the set appearance window. |
03:11 | Add symbols of your choice and choose no line. |
03:17 | This helps to differentiate the fitted data from the starting dataset. |
03:23 | Go to Data and select Transformations. |
03:27 | A sub-menu opens with many options for data fitting. |
03:32 | Choose Regression from the sub-menu. |
03:36 | New Regression dialog box opens. |
03:40 | Choose the data set of interest from Apply to set. |
03:45 | Currently only a single set is loaded, shown as (S0). |
03:51 | It is in the graph panel G1 and set is named S0. |
03:57 | Choose Exponential for Type of fit. |
04:01 | This drop-down has few choices with sample functions to do data fitting. |
04:08 | In the Load drop-down, choose Fitted values. |
04:12 | For restrictions choose None. |
04:15 | Click on Accept to run the data fitting. |
04:19 | The Grace: console dialog box opens. |
04:23 | Close the dialog box and the generated log file. |
04:28 | Notice the fitted data in the graph. |
04:32 | Often, the data may follow a complex mathematical equation. |
04:37 | Then, we have to define the equation and do a non-linear regression. |
04:43 | I will demonstrate it. |
04:46 | I will not save the details of the data fitting. |
04:50 | I will close the dialog box. |
04:53 | Let’s delete the fitted dataset loaded on the graph. |
04:58 | Go to Edit menu and open the Set Operations dialog box. |
05:04 | In the Source section, select Graph G1 as seen. |
05:10 | In the set section, select the set G1 S1. |
05:16 | Right click to open the context menu and choose Kill data. |
05:22 | A warning popup dialog box opens to confirm the process. |
05:28 | Click on OK to kill the dataset. |
05:32 | Different types of set operations are possible in this window. |
05:37 | I will click on Close, to close the dialog box. |
05:42 | You may explore further if desired. |
05:46 | Notice that the fitted data is removed from the graph. |
05:51 | We can also access the context menu from the set appearance window. |
05:57 | Select the desired dataset from the Select set form. |
06:02 | Right click to open the context menu and choose Kill data to remove the data. |
06:08 | Click on Close, to close the dialog box. |
06:12 | I will demonstrate to set up non-linear regression process. |
06:19 | For data fitting, select an equation to fit the data. |
06:24 | Make an initial guess for the value of the coefficients. |
06:29 | Run the data fitting algorithm. |
06:32 | Convergence is usually obtained with few iterations. |
06:37 | Examine the output parameters for goodness of the fit. |
06:42 | Plot the function and the data together for visual representation. |
06:49 | Go to Data, Transformations and select Non-linear curve fitting. |
06:55 | Under the Main tab, we will enter the desired equation. |
07:00 | Select 2 for Parameters. |
07:04 | Two parameters A0 and A1 appear in the form below. |
07:10 | I will use an exponential decay curve as seen on the interface. |
07:16 | Let’s type the equation as seen. |
07:20 | There is also an option to input starting values and define bounds. |
07:26 | Set Iterations to 20 using the black, up triangle button as seen on the screen. |
07:34 | Set A0 and A1 initial guess. |
07:39 | We can make an educated guess for starting values of A0 and A1 from the graph. |
07:47 | From the graph, A0 could be around point four to point 5. |
07:53 | Value of A1 is around -0.25. |
07:58 | Set the initial guess values of the coefficients slightly away. |
08:04 | Then, the iterative process in the regression algorithm can be observed. |
08:11 | Input 0.4 for A0 and -0.2 for A1 as initial guess. |
08:21 | You may apply bounds check box if necessary by clicking on the bounds buttons. |
08:28 | In the Set section, select the set, G1 S0. |
08:34 | Click on Apply to run the iterations.
The algorithm runs. |
08:41 | In this window, fitting parameter Chi-square is seen. |
08:46 | Correlation coefficient, RMS, relative error and Theil coefficient are also seen. |
08:54 | Examine the chi-square values obtained. |
08:58 | Low chi-square means, the resulting function is a good fit for the data. |
09:04 | Residual is the difference between the observed and the fitted values. |
09:10 | The sum of squares of residuals is minimized in the least square fitting method. |
09:17 | You may note down the values or save the results. |
09:22 | Click on File, Save option to save the results. |
09:27 | A Grace:save logs form appear prompting to give a file name. |
09:34 | In the form, type 'fitted-values.txt' and click on Apply. |
09:41 | Click on Close, to close the dialog box. |
09:45 | Use File, close to close the Grace:console window. |
09:50 | A curve generated from data fitting, is automatically loaded on the graph. |
09:57 | The fitted curve traverse between the given data points. |
10:03 | Click on close to close the non-linear curve fitting window. |
10:08 | Click on File, save to save the project. |
10:12 | From top menu, choose File, exit to exit Grace. |
10:19 | Now, let’s summarize.
In this tutorial, we Added multiple graph panels in the canvas |
10:29 | Learned to delete data sets from a graph panel |
10:34 | Performed non-linear regression on an exponential decay curve. |
10:41 | For assignment, please do the following. |
10:45 | Fit the data given in the file assignment1.txt to a parabola. |
10:51 | Use an equation of the type, as seen here. |
10:56 | Fit the given data in the file assignment2.txt, to atan(x). |
11:03 | Your complete assignment look similar to this. |
11:09 | This video summarises the Spoken Tutorial Project.
Please download and watch it. |
11:17 | The Spoken Tutorial Project team: conducts workshops and gives certificates.
For more details, please write to us. |
11:28 | Please post your timed queries in this forum. |
11:32 | Spoken Tutorial Project is funded by MHRD, Government of India.
|
11:39 | This is Rani, from IIT Bombay. Thank you for joining. |