Difference between revisions of "Grace/C3/Fit-an-Exponential-Decay-Curve/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(11 intermediate revisions by 3 users not shown)
Line 6: Line 6:
 
|| '''Slide Number 1'''
 
|| '''Slide Number 1'''
 
'''Title Slide'''
 
'''Title Slide'''
|| Welcome to the tutorial on '''Fit an exponential decay curve'''.
+
|| Welcome to the tutorial on '''Fit an exponential Decay Curve'''.
  
 
|-
 
|-
Line 14: Line 14:
 
* Add multiple graph panels to the canvas
 
* Add multiple graph panels to the canvas
 
* Remove dataset from the graph panel and
 
* Remove dataset from the graph panel and
* Fit a given set of datapoints with non-linear regression method.
+
* Fit a given set of data points with non-linear regression method.
  
 
|-
 
|-
Line 30: Line 30:
 
* Learner must be familiar with the '''Grace''' interface.
 
* Learner must be familiar with the '''Grace''' interface.
 
* For pre-requisite tutorials, please visit this site.
 
* For pre-requisite tutorials, please visit this site.
 +
 +
|-
 +
|| '''Slide Number 5'''
 +
'''Code Files'''
 +
||
 +
* Two input files used in this tutorial are provided in the code files link.
 +
* Please download and extract the files.
 +
  
 
|-
 
|-
 
|| Show '''Desktop''' screenshot with '''exponential.txt''' file icon.
 
|| Show '''Desktop''' screenshot with '''exponential.txt''' file icon.
|| Two input files used in this tutorial are provided in the '''Code files''' link.
+
|| I have downloaded and saved them on my '''Desktop'''.
I have downloaded and saved them on my '''Desktop'''.
+
  
 
|-
 
|-
Line 41: Line 48:
  
 
|-
 
|-
|| Click on '''File, Open'''.  
+
|| Click on '''File''', '''Open'''.  
|| Click on '''File, Open''' to open a project.
+
|| Click on '''File''', '''Open''' to open a project.
  
 
|-
 
|-
|| Show screenshot of open project dialogue box, loading the project.
+
|| Show screenshot of open project dialog box, loading the project.
 
|| Open the '''regression.arg''' project file from the '''Desktop''' directory.
 
|| Open the '''regression.arg''' project file from the '''Desktop''' directory.
  
Line 51: Line 58:
 
|| Point to the straight line graph.
 
|| Point to the straight line graph.
 
|| A straight line graph is plotted on this plot window.
 
|| A straight line graph is plotted on this plot window.
 +
 
Let's add another graph panel to the canvas.
 
Let's add another graph panel to the canvas.
  
 
|-
 
|-
 
|| Go to '''Edit, '''Select''' Arrange''' '''graphs '''option.
 
|| Go to '''Edit, '''Select''' Arrange''' '''graphs '''option.
Cursor in '''Arrange graphs''' dialogue box.
+
Cursor in '''Arrange graphs''' dialog box.
 
|| Go to the '''Edit''' menu, select '''Arrange graphs''' option.
 
|| Go to the '''Edit''' menu, select '''Arrange graphs''' option.
 +
 
The '''Arrange graphs''' window opens.
 
The '''Arrange graphs''' window opens.
  
 
|-
 
|-
|| In '''Matrix''' > '''Cols''', increase the number of rows to 2.
+
|| In '''Matrix''', '''Cols''', increase the number of rows to 2.
 
|| Under '''Matrix''', in the '''Cols''' drop-down increase the number of columns to 2.
 
|| Under '''Matrix''', in the '''Cols''' drop-down increase the number of columns to 2.
  
Line 66: Line 75:
 
|| Click on '''Apply''', then click Close.
 
|| Click on '''Apply''', then click Close.
 
|| Click on '''Apply''' and then on click '''Close'''.
 
|| Click on '''Apply''' and then on click '''Close'''.
 +
 
Notice that one more graph panel is added to the white canvas.
 
Notice that one more graph panel is added to the white canvas.
  
Line 71: Line 81:
 
|| Resize both graph panels to two squares.
 
|| Resize both graph panels to two squares.
 
|| Notice that the graph panels are now elongated.
 
|| Notice that the graph panels are now elongated.
 +
 
I will resize the graph panels to two squares as seen on the screen.
 
I will resize the graph panels to two squares as seen on the screen.
  
Line 80: Line 91:
 
|| Click on the new Graph to select .
 
|| Click on the new Graph to select .
 
|| To select a graph, click on it.  
 
|| To select a graph, click on it.  
 +
 
The selected graph is highlighted with the black squares on the corners.
 
The selected graph is highlighted with the black squares on the corners.
  
Line 88: Line 100:
 
|-
 
|-
 
|| Go to '''File, Import, ASCII'''.
 
|| Go to '''File, Import, ASCII'''.
 +
 
Go to '''Desktop''' folder and navigate to select the saved file '''exponential.txt'''.
 
Go to '''Desktop''' folder and navigate to select the saved file '''exponential.txt'''.
 
|| Go to '''Data, Import, ASCII''' in the menu.
 
|| Go to '''Data, Import, ASCII''' in the menu.
Select the file,''' exponential.txt''' from '''Desktop''' directory.
+
 
 +
Select the file, '''exponential.txt''' from '''Desktop''' directory.
  
 
|-
 
|-
 
|| Click on '''Ok''' to plot the graph.
 
|| Click on '''Ok''' to plot the graph.
 +
 
Click on '''Cancel '''to close the window.
 
Click on '''Cancel '''to close the window.
 
|| Load the data as an '''XY''' dataset.
 
|| Load the data as an '''XY''' dataset.
 +
 
Click on '''Ok''' to plot the graph.
 
Click on '''Ok''' to plot the graph.
 +
 
Then, click on '''Cancel''' to close the window.
 
Then, click on '''Cancel''' to close the window.
  
Line 102: Line 119:
 
|| Cursor on the graph.
 
|| Cursor on the graph.
 
|| From a visual inspection, the data points follow an exponential decay curve.
 
|| From a visual inspection, the data points follow an exponential decay curve.
For example bleaching clothes follows an exponential decay curve.
 
  
 
|-
 
|-
Line 111: Line 127:
 
|| Show screenshot of formatted graph.
 
|| Show screenshot of formatted graph.
 
|| Add '''symbols''' of your choice and choose no line.
 
|| Add '''symbols''' of your choice and choose no line.
 +
 
This helps to differentiate the fitted data from the starting dataset.
 
This helps to differentiate the fitted data from the starting dataset.
  
Line 118: Line 135:
  
 
|-
 
|-
|| Hover the mouse on the submenu.
+
|| Hover the mouse on the sub-menu.
|| A submenu opens with many options for data fitting.
+
|| A sub-menu opens with many options for data fitting.
  
 
|-
 
|-
|| Choose '''Regression '''from the submenu.
+
|| Choose '''Regression '''from the sub-menu.
Point to the dialogue box.
+
Point to the dialog box.
|| Choose '''Regression '''from the submenu.
+
|| Choose '''Regression''' from the sub-menu.
New '''Regression''' '''dialogue box''' opens.
+
 
 +
New '''Regression dialog box''' opens.
  
 
|-
 
|-
|| Show dataset on screen, Choose '''G1 (S0)'''.
+
|| Show dataset on the screen, Choose '''G1 (S0)'''.
 
|| Choose the data set of interest from '''Apply to set'''.
 
|| Choose the data set of interest from '''Apply to set'''.
Currently only a single set is loaded, shown as '''(S0)''' .
+
 
It is in the graph panel is '''G1''', and set is named '''S0'''.
+
Currently only a single set is loaded, shown as '''(S0)'''.
 +
 
 +
It is in the graph panel '''G1''' and set is named '''S0'''.
  
 
|-
 
|-
 
|| Choose '''Exponential''' for '''Type of fit'''.
 
|| Choose '''Exponential''' for '''Type of fit'''.
 
|| Choose '''Exponential''' for '''Type of fit'''.
 
|| Choose '''Exponential''' for '''Type of fit'''.
This drop-down has few choices with simple functions to do data fitting.
+
 
 +
This drop-down has few choices with sample functions to do data fitting.
  
 
|-
 
|-
 
|| For '''Load''', choose '''Fitted values'''.
 
|| For '''Load''', choose '''Fitted values'''.
|| In '''Load''' drop-down, choose '''Fitted values'''.
+
|| In the '''Load''' drop-down, choose '''Fitted values'''.
  
 
|-
 
|-
Line 154: Line 175:
 
Close the dialog box.
 
Close the dialog box.
 
|| The '''Grace: console''' dialog box opens.
 
|| The '''Grace: console''' dialog box opens.
Close the dialogue box and the generated log file.
+
 
 +
Close the dialog box and the generated log file.
  
 
|-
 
|-
Line 162: Line 184:
 
|-
 
|-
 
|| Hover mouse over the curve.
 
|| Hover mouse over the curve.
|| Often, the data may follow a complex Mathematical equation.  
+
|| Often, the data may follow a complex mathematical equation.  
Then, we have to define the equation, and do a non-linear regression.
+
 
 +
Then, we have to define the equation and do a non-linear regression.
  
 
|-
 
|-
 
|| Cursor on the graph.
 
|| Cursor on the graph.
 
|| I will demonstrate it.
 
|| I will demonstrate it.
 +
 
I will not save the details of the data fitting.  
 
I will not save the details of the data fitting.  
I will close the dialogue box.
+
 
 +
I will close the dialog box.
 +
 
 
Let’s delete the fitted dataset loaded on the graph.
 
Let’s delete the fitted dataset loaded on the graph.
  
 
|-
 
|-
 
|| Go to Edit, Set operations.
 
|| Go to Edit, Set operations.
|| Go to '''Edit''' menu and open the '''Set Operations''' dialogue box.
+
|| Go to '''Edit''' menu and open the '''Set Operations''' dialog box.
  
 
|-
 
|-
 
|| Select Graph '''G1''' in the '''Source''' section.
 
|| Select Graph '''G1''' in the '''Source''' section.
|| In the '''Source''' section, Select Graph '''G1''' as seen.
+
|| In the '''Source''' section, select Graph '''G1''' as seen.
  
 
|-
 
|-
 
|| Select, G1. S1 set.
 
|| Select, G1. S1 set.
 
|| In the '''set''' section, select the set '''G1 S1'''.
 
|| In the '''set''' section, select the set '''G1 S1'''.
 +
 
Right click to open the '''context menu''' and choose '''Kill data'''.
 
Right click to open the '''context menu''' and choose '''Kill data'''.
  
 
|-
 
|-
 
|| Click on '''OK'''.
 
|| Click on '''OK'''.
|| A '''warning popup''' dialogue box opens to confirm the process.
+
|| A '''warning popup''' dialog box opens to confirm the process.
 +
 
 
Click on '''OK''' to kill the dataset.
 
Click on '''OK''' to kill the dataset.
  
Line 196: Line 224:
 
|-
 
|-
 
|| Click on '''Close'''.
 
|| Click on '''Close'''.
|| I will click on '''Close''', to close the dialogue box.
+
|| I will click on '''Close''', to close the dialog box.
 +
 
 
You may explore further if desired.
 
You may explore further if desired.
  
Line 210: Line 239:
 
|| Select a set and right click to show '''context menu'''.
 
|| Select a set and right click to show '''context menu'''.
 
|| Select the desired dataset from the '''Select set''' form.  
 
|| Select the desired dataset from the '''Select set''' form.  
Right click to open the '''context menu''' and choose '''Kill data''' to remove  
+
 
the data.
+
Right click to open the '''context menu''' and choose '''Kill data''' to remove the data.
  
 
|-
 
|-
 
|| Click on '''Close'''.
 
|| Click on '''Close'''.
|| Click on '''Close''', to close the dialogue box.
+
|| Click on '''Close''', to close the dialog box.
I will demonstrate to set up '''non-linear regression''' process.
+
 
 +
I will demonstrate to set up '''non-linear regression''' process.
 +
.
  
 
|-
 
|-
|| '''Slide Number 5'''
+
|| '''Slide Number 6'''
 
'''Steps for Data Fitting'''
 
'''Steps for Data Fitting'''
|| * For data fitting, select an equation to fit the data.
+
||  
 +
* For data fitting, select an equation to fit the data.
 
* Make an initial guess for the value of the coefficients.
 
* Make an initial guess for the value of the coefficients.
 
* Run the data fitting algorithm.
 
* Run the data fitting algorithm.
  
 
|-
 
|-
|| '''Slide Number 6'''
+
|| '''Slide Number 7'''
 
'''Steps for Data Fitting'''
 
'''Steps for Data Fitting'''
|| * Convergence is usually obtained with few iterations.
+
||  
 +
* Convergence is usually obtained with few iterations.
 
* Examine the output parameters for goodness of the fit.
 
* Examine the output parameters for goodness of the fit.
* Plot the function and the data together for visual inspection.
+
* Plot the function and the data together for visual representation.
  
 
|-
 
|-
|| Go to '''Data ,Transformations, Non-linear curve fitting'''.
+
|| Go to '''Data''' , '''Transformations''', '''Non-linear curve fitting'''.
|| Go to '''Data,Transformations''' and select '''Non-linear curve fitting'''.
+
|| Go to '''Data''', '''Transformations''' and select '''Non-linear curve fitting'''.
  
 
|-
 
|-
Line 244: Line 277:
 
Point to the five parameters in the form.
 
Point to the five parameters in the form.
 
|| Select '''2''' for '''Parameters'''.
 
|| Select '''2''' for '''Parameters'''.
Two parameters '''A0''' to '''A1''' appear in the form below.
+
 
 +
Two parameters '''A0''' and '''A1''' appear in the form below.
  
 
|-
 
|-
 
|| Type, '''y= A0 * exp(A1*x)'''
 
|| Type, '''y= A0 * exp(A1*x)'''
 
|| I will use an exponential decay curve as seen on the interface.
 
|| I will use an exponential decay curve as seen on the interface.
 +
 
Let’s type the equation as seen.
 
Let’s type the equation as seen.
  
Line 254: Line 289:
 
|| Set '''Iterations''' to 20 using the black, up triangle button.
 
|| Set '''Iterations''' to 20 using the black, up triangle button.
 
|| There is also an option to input starting values and define bounds.
 
|| There is also an option to input starting values and define bounds.
I will leave it as it and not change it.
+
 
 
Set '''Iterations''' to 20 using the black, up triangle button as seen on the screen.
 
Set '''Iterations''' to 20 using the black, up triangle button as seen on the screen.
  
 
|-
 
|-
 
|| Cursor on '''A0''', '''A1'''.
 
|| Cursor on '''A0''', '''A1'''.
|| Set '''A0''' and '''A1''' initial guess and limits.
+
|| Set '''A0''' and '''A1''' initial guess.
  
 
|-
 
|-
 
|| Cursor on the graph.
 
|| Cursor on the graph.
 
|| We can make an educated guess for starting values of '''A0''' and '''A1''' from the graph.
 
|| We can make an educated guess for starting values of '''A0''' and '''A1''' from the graph.
 +
 
From the graph, '''A0''' could be around point four to point 5.
 
From the graph, '''A0''' could be around point four to point 5.
 +
 
Value of '''A1''' is around -0.25.
 
Value of '''A1''' is around -0.25.
  
Line 270: Line 307:
 
|| Input 0.4 for A0 and -0.2 for A1.
 
|| Input 0.4 for A0 and -0.2 for A1.
 
|| Set the initial guess values of the coefficients slightly away.
 
|| Set the initial guess values of the coefficients slightly away.
 +
 
Then, the iterative process in the regression algorithm can be observed.
 
Then, the iterative process in the regression algorithm can be observed.
 +
 
Input 0.4 for '''A0''' and -0.2 for '''A1''' as initial guess.
 
Input 0.4 for '''A0''' and -0.2 for '''A1''' as initial guess.
  
Line 278: Line 317:
  
 
|-
 
|-
|| In the '''Set''' section, select the set, '''G1 S1'''.
+
|| In the '''Set''' section, select the set, '''G1 S0'''.
|| In the '''Set''' section, select the set, '''G1 S1'''.
+
|| In the '''Set''' section, select the set, '''G1 S0'''.
  
 
|-
 
|-
Line 285: Line 324:
 
|| Click on '''Apply''' and to run the iterations.
 
|| Click on '''Apply''' and to run the iterations.
  
|-
+
The algorithm runs.
|| '''Grace:console''' window appear.
+
|| The algorithm runds.
+
A '''Grace:console''' window appears.
+
  
 
|-
 
|-
 
|| Hover mouse over the '''parameters'''.
 
|| Hover mouse over the '''parameters'''.
 
|| In this window, fitting parameter '''Chi-square''' is seen.
 
|| In this window, fitting parameter '''Chi-square''' is seen.
 +
 
'''Correlation coefficient, RMS, relative error''' and '''Theil coefficient''' are also seen.
 
'''Correlation coefficient, RMS, relative error''' and '''Theil coefficient''' are also seen.
  
Line 298: Line 335:
 
|| Cursor on '''chi square'''.
 
|| Cursor on '''chi square'''.
 
|| Examine the '''chi-square''' values obtained.  
 
|| Examine the '''chi-square''' values obtained.  
 +
 
Low '''chi-square''' means, the resulting function is a good fit for the data.
 
Low '''chi-square''' means, the resulting function is a good fit for the data.
  
Line 303: Line 341:
 
|| Cursor on the output values of '''residual''', '''RMS'''.
 
|| Cursor on the output values of '''residual''', '''RMS'''.
 
|| '''Residual''' is the difference between the observed and the fitted values.
 
|| '''Residual''' is the difference between the observed and the fitted values.
The sum of '''squares''' of residuals is minimized in the least square fitting method.
+
 
 +
The '''sum of squares''' of residuals is minimized in the least square fitting method.
  
 
|-
 
|-
 
|| Click on '''File, Save'''.
 
|| Click on '''File, Save'''.
 
|| You may note down the values or save the results.
 
|| You may note down the values or save the results.
 +
 
Click on '''File, Save''' option to save the results.
 
Click on '''File, Save''' option to save the results.
  
Line 313: Line 353:
 
|| In the form, type ''''fitted-values.txt'''' and click on '''Apply'''.
 
|| In the form, type ''''fitted-values.txt'''' and click on '''Apply'''.
 
|| A '''Grace:save logs''' form appear prompting to give a file name.
 
|| A '''Grace:save logs''' form appear prompting to give a file name.
In the form of '''Save file as''', type ''''fitted-values.txt'''' and click on '''Accept'''.
 
  
 +
In the form, type ''''fitted-values.txt'''' and click on '''Apply'''.
 
|-
 
|-
 
|| Click on '''Close'''.
 
|| Click on '''Close'''.
|| Click on '''Close''', to close the dialogue box.
+
|| Click on '''Close''', to close the dialog box.
  
 
|-
 
|-
Line 326: Line 366:
 
|| Cursor on graph.
 
|| Cursor on graph.
 
|| A curve generated from data fitting, is automatically loaded on the graph.
 
|| A curve generated from data fitting, is automatically loaded on the graph.
 +
 
The fitted curve traverse between the given data points.
 
The fitted curve traverse between the given data points.
  
Line 341: Line 382:
  
 
|-
 
|-
|| '''Slide Number 7'''
+
|| '''Slide Number 8'''
 
'''Summary'''
 
'''Summary'''
 
|| Now, let’s summarize.
 
|| Now, let’s summarize.
 +
 
In this tutorial, we
 
In this tutorial, we
 
* Added multiple graph panels in the canvas
 
* Added multiple graph panels in the canvas
Line 350: Line 392:
  
 
|-
 
|-
|| '''Slide Number 8'''
+
|| '''Slide Number 9'''
 
'''Assignment 1'''
 
'''Assignment 1'''
 
'''y= a<sub>0.</sub>x<sup>2</sup> + a1.x + a<sub>2'''
 
'''y= a<sub>0.</sub>x<sup>2</sup> + a1.x + a<sub>2'''
Line 358: Line 400:
  
 
|-
 
|-
|| '''Slide Number 9'''
+
|| '''Slide Number 10'''
 
'''Assignment 2'''
 
'''Assignment 2'''
 
|| * Fit the given data in the file '''assignment2.txt''', to '''atan(x)'''.
 
|| * Fit the given data in the file '''assignment2.txt''', to '''atan(x)'''.
Line 367: Line 409:
  
 
|-
 
|-
|| '''Slide Number 10'''
+
|| '''Slide Number 11'''
 
'''Spoken Tutorial Project'''
 
'''Spoken Tutorial Project'''
 
|| This video summarises the '''Spoken Tutorial''' Project.
 
|| This video summarises the '''Spoken Tutorial''' Project.
 +
 
Please download and watch it.
 
Please download and watch it.
  
 
|-
 
|-
|| '''Slide Number 11'''
+
|| '''Slide Number 12'''
 
'''Spoken Tutorial workshops'''
 
'''Spoken Tutorial workshops'''
 
|| The '''Spoken Tutorial Project '''team:
 
|| The '''Spoken Tutorial Project '''team:
 
* conducts workshops and
 
* conducts workshops and
 
* gives certificates.
 
* gives certificates.
 +
 
For more details, please write to us.
 
For more details, please write to us.
  
 
|-
 
|-
|| '''Slide Number 12'''
+
|| '''Slide Number 13'''
 
'''Forum for specific questions:'''
 
'''Forum for specific questions:'''
 
|| Please post your timed queries in this forum.
 
|| Please post your timed queries in this forum.
  
 
|-
 
|-
|| '''Slide Number 13'''
+
|| '''Slide Number 14'''
 
'''Acknowledgement'''
 
'''Acknowledgement'''
 
|| '''Spoken Tutorial''' Project is funded by '''MHRD''', '''Government of India'''.
 
|| '''Spoken Tutorial''' Project is funded by '''MHRD''', '''Government of India'''.

Latest revision as of 16:17, 28 October 2020

Visual Cue Narration
Slide Number 1

Title Slide

Welcome to the tutorial on Fit an exponential Decay Curve.
Slide Number 2

Learning Objectives

In this tutorial, we will learn to,
  • Add multiple graph panels to the canvas
  • Remove dataset from the graph panel and
  • Fit a given set of data points with non-linear regression method.
Slide Number 3

System and Software Requirement

To record this tutorial, I am using
  • Ubuntu Linux 16.04 OS
  • Grace 5.1.25
  • Gedit 3.18.3
Slide Number 4

Pre-requisites

To follow this tutorial,
  • Learner must be familiar with the Grace interface.
  • For pre-requisite tutorials, please visit this site.
Slide Number 5

Code Files

  • Two input files used in this tutorial are provided in the code files link.
  • Please download and extract the files.


Show Desktop screenshot with exponential.txt file icon. I have downloaded and saved them on my Desktop.
Open Grace. I have opened the Grace interface.
Click on File, Open. Click on File, Open to open a project.
Show screenshot of open project dialog box, loading the project. Open the regression.arg project file from the Desktop directory.
Point to the straight line graph. A straight line graph is plotted on this plot window.

Let's add another graph panel to the canvas.

Go to Edit, Select Arrange graphs option.

Cursor in Arrange graphs dialog box.

Go to the Edit menu, select Arrange graphs option.

The Arrange graphs window opens.

In Matrix, Cols, increase the number of rows to 2. Under Matrix, in the Cols drop-down increase the number of columns to 2.
Click on Apply, then click Close. Click on Apply and then on click Close.

Notice that one more graph panel is added to the white canvas.

Resize both graph panels to two squares. Notice that the graph panels are now elongated.

I will resize the graph panels to two squares as seen on the screen.

Reposition the legends in G0 graph. I will also reposition the legends in the canvas.
Click on the new Graph to select . To select a graph, click on it.

The selected graph is highlighted with the black squares on the corners.

Select the newly added graph panel. Select the newly added graph panel.
Go to File, Import, ASCII.

Go to Desktop folder and navigate to select the saved file exponential.txt.

Go to Data, Import, ASCII in the menu.

Select the file, exponential.txt from Desktop directory.

Click on Ok to plot the graph.

Click on Cancel to close the window.

Load the data as an XY dataset.

Click on Ok to plot the graph.

Then, click on Cancel to close the window.

Cursor on the graph. From a visual inspection, the data points follow an exponential decay curve.
Double click on the graph line. Double click on the curve to open the set appearance window.
Show screenshot of formatted graph. Add symbols of your choice and choose no line.

This helps to differentiate the fitted data from the starting dataset.

Go to Data, Transformations. Go to Data and select Transformations.
Hover the mouse on the sub-menu. A sub-menu opens with many options for data fitting.
Choose Regression from the sub-menu.

Point to the dialog box.

Choose Regression from the sub-menu.

New Regression dialog box opens.

Show dataset on the screen, Choose G1 (S0). Choose the data set of interest from Apply to set.

Currently only a single set is loaded, shown as (S0).

It is in the graph panel G1 and set is named S0.

Choose Exponential for Type of fit. Choose Exponential for Type of fit.

This drop-down has few choices with sample functions to do data fitting.

For Load, choose Fitted values. In the Load drop-down, choose Fitted values.
For restrictions choose None. For restrictions choose None.
Click on Accept. Click on Accept to run the data fitting.
Point to the dialog box.

Close the dialog box.

The Grace: console dialog box opens.

Close the dialog box and the generated log file.

Cursor on the graph. Notice the fitted data in the graph.
Hover mouse over the curve. Often, the data may follow a complex mathematical equation.

Then, we have to define the equation and do a non-linear regression.

Cursor on the graph. I will demonstrate it.

I will not save the details of the data fitting.

I will close the dialog box.

Let’s delete the fitted dataset loaded on the graph.

Go to Edit, Set operations. Go to Edit menu and open the Set Operations dialog box.
Select Graph G1 in the Source section. In the Source section, select Graph G1 as seen.
Select, G1. S1 set. In the set section, select the set G1 S1.

Right click to open the context menu and choose Kill data.

Click on OK. A warning popup dialog box opens to confirm the process.

Click on OK to kill the dataset.

Hover mouse over the possible set operations. Different types of set operations are possible in this window.
Click on Close. I will click on Close, to close the dialog box.

You may explore further if desired.

Cursor on the graph. Notice that the fitted data is removed from the graph.
Show set appearance window. We can also access the context menu from the set appearance window.
Select a set and right click to show context menu. Select the desired dataset from the Select set form.

Right click to open the context menu and choose Kill data to remove the data.

Click on Close. Click on Close, to close the dialog box.

I will demonstrate to set up non-linear regression process. .

Slide Number 6

Steps for Data Fitting

  • For data fitting, select an equation to fit the data.
  • Make an initial guess for the value of the coefficients.
  • Run the data fitting algorithm.
Slide Number 7

Steps for Data Fitting

  • Convergence is usually obtained with few iterations.
  • Examine the output parameters for goodness of the fit.
  • Plot the function and the data together for visual representation.
Go to Data , Transformations, Non-linear curve fitting. Go to Data, Transformations and select Non-linear curve fitting.
Point to In the Main tab. Under the Main tab, we will enter the desired equation.
Select 2 for Parameters.

Point to the five parameters in the form.

Select 2 for Parameters.

Two parameters A0 and A1 appear in the form below.

Type, y= A0 * exp(A1*x) I will use an exponential decay curve as seen on the interface.

Let’s type the equation as seen.

Set Iterations to 20 using the black, up triangle button. There is also an option to input starting values and define bounds.

Set Iterations to 20 using the black, up triangle button as seen on the screen.

Cursor on A0, A1. Set A0 and A1 initial guess.
Cursor on the graph. We can make an educated guess for starting values of A0 and A1 from the graph.

From the graph, A0 could be around point four to point 5.

Value of A1 is around -0.25.

Input 0.4 for A0 and -0.2 for A1. Set the initial guess values of the coefficients slightly away.

Then, the iterative process in the regression algorithm can be observed.

Input 0.4 for A0 and -0.2 for A1 as initial guess.

Hover mouse on apply bounds check box. You may apply bounds check box if necessary by clicking on the bounds buttons.
In the Set section, select the set, G1 S0. In the Set section, select the set, G1 S0.
Click Apply and to run iterations. Click on Apply and to run the iterations.

The algorithm runs.

Hover mouse over the parameters. In this window, fitting parameter Chi-square is seen.

Correlation coefficient, RMS, relative error and Theil coefficient are also seen.

Cursor on chi square. Examine the chi-square values obtained.

Low chi-square means, the resulting function is a good fit for the data.

Cursor on the output values of residual, RMS. Residual is the difference between the observed and the fitted values.

The sum of squares of residuals is minimized in the least square fitting method.

Click on File, Save. You may note down the values or save the results.

Click on File, Save option to save the results.

In the form, type 'fitted-values.txt' and click on Apply. A Grace:save logs form appear prompting to give a file name.

In the form, type 'fitted-values.txt' and click on Apply.

Click on Close. Click on Close, to close the dialog box.
Click on File, close to close Grace:console window, Use File, close to close the Grace:console window.
Cursor on graph. A curve generated from data fitting, is automatically loaded on the graph.

The fitted curve traverse between the given data points.

Click on Close to close the non-linear curve fitting window. Click on close to close the non-linear curve fitting window.
Click on File, save. Click on File, save to save the project.
Click on File, Exit. From top menu, choose File, exit to exit Grace.
Slide Number 8

Summary

Now, let’s summarize.

In this tutorial, we

  • Added multiple graph panels in the canvas
  • Learned to delete data sets from a graph panel
  • Performed non-linear regression on an exponential decay curve.
Slide Number 9

Assignment 1 y= a0.x2 + a1.x + a2

For assignment, please do the following.
  • Fit the data given in the file assignment1.txt to a parabola.
  • Use an equation of the type, as seen here.
Slide Number 10

Assignment 2

* Fit the given data in the file assignment2.txt, to atan(x).
Glimpse of assignment. Your complete assignment look similar to this.
Slide Number 11

Spoken Tutorial Project

This video summarises the Spoken Tutorial Project.

Please download and watch it.

Slide Number 12

Spoken Tutorial workshops

The Spoken Tutorial Project team:
  • conducts workshops and
  • gives certificates.

For more details, please write to us.

Slide Number 13

Forum for specific questions:

Please post your timed queries in this forum.
Slide Number 14

Acknowledgement

Spoken Tutorial Project is funded by MHRD, Government of India.


This is Rani, from IIT Bombay.

Thank you for joining.

Contributors and Content Editors

Madhurig, PoojaMoolya, Ranipv076, Snehalathak