Difference between revisions of "Grace/C3/DataFitting/English"
Line 37:  Line 37:  
 * Data fitting is a process to find a mathematical relation between two variables.   * Data fitting is a process to find a mathematical relation between two variables.  
* An equation is used to describe the XY dataset pair.  * An equation is used to describe the XY dataset pair.  
+  
+    
+  '''Slide Number 6'''  
+  '''Data fitting'''  
+    
* Using an iterative process, the coefficients are optimized.  * Using an iterative process, the coefficients are optimized.  
* The process returns the best possible coefficients for the equation.  * The process returns the best possible coefficients for the equation.  
Line 81:  Line 86:  
    
−   '''Slide Number  +   '''Slide Number 7''' 
'''Equation in two variables'''  '''Equation in two variables'''  
 A straight line is described by an equation in two variables,   A straight line is described by an equation in two variables,  
Line 325:  Line 330:  
    
−   '''Slide Number  +   '''Slide Number 8''' 
'''Summary'''  '''Summary'''  
 In this tutorial we,   In this tutorial we,  
Line 334:  Line 339:  
    
−   '''Slide Number  +   '''Slide Number 9''' 
'''Assignment'''  '''Assignment'''  
 For assignment activity, please do the following.   For assignment activity, please do the following.  
Line 340:  Line 345:  
(parabola1.txt & parabola2.txt)  (parabola1.txt & parabola2.txt)  
* Plot them in the same graph panel.  * Plot them in the same graph panel.  
−  * Perform  +  * Perform quadratic regression on the '''parabola1.txt''' file. 
    
−   '''Slide Number  +   '''Slide Number 10''' 
'''Assignment'''  '''Assignment'''  
    
Line 355:  Line 360:  
    
−   '''Slide Number  +   '''Slide Number 11''' 
'''Spoken Tutorial Project'''  '''Spoken Tutorial Project'''  
 This video summarizes the '''Spoken Tutorial Project'''.   This video summarizes the '''Spoken Tutorial Project'''.  
Line 361:  Line 366:  
    
−   '''Slide Number  +   '''Slide Number 12''' 
'''Spoken Tutorial workshops'''  '''Spoken Tutorial workshops'''  
 The '''Spoken Tutorial Project''' team:   The '''Spoken Tutorial Project''' team:  
Line 369:  Line 374:  
    
−   '''Slide Number  +   '''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  +   '''Slide Number 14''' 
'''Acknowledgement'''  '''Acknowledgement'''  
 Spoken Tutorial Project is funded by '''NMEICT, MHRD''', Government of India.   Spoken Tutorial Project is funded by '''NMEICT, MHRD''', Government of India. 
Latest revision as of 18:48, 3 December 2019
Visual Cue  Narration 
Slide Number 1
Title Slide 
Welcome to the tutorial on Data fitting in Grace. 
Slide Number 2
Learning Objectives 
In this tutorial, we will

Slide Number 3
System and Software Requirement 
To record this tutorial, I am using

Slide Number 4
Prerequisites https://spokentutorial.org 
To follow this tutorial,

Slide Number 5
Data fitting 
* Data fitting is a process to find a mathematical relation between two variables.

Slide Number 6
Data fitting 

Go to Desktop.  Go to Desktop. 
Hover mouse over file, linefit.txt.  Notice the file, linefit.txt.
This file is provided to you in the Code Files link. I have downloaded, extracted and saved the file to the Desktop directory. 
Show screenshot of Grace readsets dialogue box.  Next, open the Grace program and load this file to plot an XY graph. 
Show screenshot of XY data set, and autoscale data.  Choose XY data set, and autoscale data. 
Hover mouse over the data.  Next I will format the plot. 
Show screenshot for : change the symbol, size, pattern. choose filled circle adjust size to 35.  I have changed the symbols, line style, tick marks and axis labels. 
Move the cursor along the data points.  The data points do not lie on a straight line.
The data points look scattered around a straight line. 
Cursor on the graph.  We will fit this data to a straight line.
For a straight line, this is process is called linear regression. 
Slide Number 7
Equation in two variables 
A straight line is described by an equation in two variables,
The equation has the form, y equals mx+c. Here, m is the slope of the line and c is the intercept. 
Go to Data,Transformations.  Go to Data and select Transformations.
Notice the available options. 
Choose Regression.  Choose Regression from the list.
A Regression dialogue box opens. 
Hover mouse over S(0).
Choose dataset (S0). 
Choose the data set of interest from Apply to set.
Currently only a single set is loaded and it is shown as S0. The next number is the number of points that are present in the dataset. 
Choose linear for Type of fit.  If many datasets are loaded more sets will be seen, in the Apply to set box.
Choose linear for Type of fit. 
for Load, choose Fitted values.  In the Load dropdown, choose Fitted values. 
For restrictions choose None.  For restrictions choose None.
If only part of the data set needs to be fitted, enter the required range. 
Hover mouse over start load at and stop load at values.
Click on Accept. 
We can also specify the start load at and stop load at values in the form.
I will leave it as is and will not make changes here. Click on Accept to run the data fitting. 
Show the Grace console window, and output values.  The data fitting algorithm runs.
A Grace console window appears with mathematical details. 
Scroll in the Console window to show the values.  We can see the equation used for the fitting.
The output values of residual, slope, intercept and other parameters are seen. 
Show on screen S(1) dataset showing in panel.  The fitted line appears on the screen.
The fitted values are loaded in a different set, S1. 
Click on File, Save.  Click on File, Save to save the parameters. 
Show the opened Grace: Save logs.  The Grace: Save logs window opens. 
Type lineregression.txt in Save to file.  In Save to file text box, type the filename as lineregression.txt. 
Click on Apply and click to close.  Click on Apply and then click on Close to close the dialogue box. 
Close Grace:Console by File, Close or Esc  Close the Grace Console by File, Close or press theEsc key. 
Click on Close in Regression window.  Click on Close in the Regression window. 
Double click on the line in the graph.  Double click on the line in the graph.
Grace Set appearance window opens. 
In select set form, select (S1) data set.  In the select set form, select S1 data set.
This is the fitted data. 
Rightclick, select Edit, In spreadsheet option.  Right click to open the context menu.
Select Edit, and in In spreadsheet option. The Grace: Spreadsheet dataset editor appears. 
Hover mouse over x and y columns.  Notice the x and corresponding fitted y values of the fitted data.
These values are different from the input data. 
Hover mouse over the fitted line.  This line fits the input data best, with a linear equation. 
Close the Spreadsheet dataset Editor.  Close the Spreadsheet dataset Editor. 
Hover mouse over the two datasets.  The original data set and the fitted values are the 2 datasets in the graph.
Datasets are labeled as [S0] for first set and [S1] for the second set. 
Cursor on the graph.  We can add more datasets to this graph panel.
For this load the data using the Data, import, ASCII option from the menu. 
Cursor on the plot window.  Next, we will add legends to the plot. 
Double click on the line to open Set Appearance window.  Open the Set Appearance window and choose the dataset S0. 
Type Data in String field.
Click on Apply. 
Under Legend, in the String field, type Data as the legend label.
Click on Apply. 
Choose S1 dataset.  Next choose S1 dataset from the Select set data form. 
Type Fitted data for the legend string and click on Apply.  Here, I will type Fitted data for the legend and click on Apply. 
Click on Close to close Set Appearance window.  Close the Set Appearance window. 
Cursor the the legend.  For some users, the legend position may be outside the graph border. 
Cursor in the legend box and press Ctrl+L .  To reposition the legends, place the cursor in the legend box.
Then press Control and L keys together. 
Show the cursor change on the screen.  The cursor changes to a pointer. 
Left click and drag the legend box to the desired position.  Left click and drag the legend box to the desired position. 
Press Enter and then press Esc key.  Then, press Enter.
Press the Escape key to exit the movement mode. 
Open Graph appearance, Legend tab.  Next, open the Graph appearance window.
In the window, click on the Legends tab, to format the legend fonts. 
Move size slider to 70.  Under the text properties, move the character size slider to 70.
The legends look very large compared to the graph. 
Click on the font dropdown.  I will retain the font type as TimesRoman. 
Click on Apply.  Click on Apply to apply the changes. 
Click on the legend boxtab.  Click on the legend box tab. 
Hover mouse next to Legend location.  We can also specify the position of the legend in the location section.
I will leave it as is. 
In pattern dropdown, choose None.  In the Frame line section, for Pattern, I will choose None. 
Click on Apply.  Click on Apply.
This will remove the legend frame box. 
Click on Close.  Then Close the dialogue box. 
Show screenshot of save as dialogue box with name filled in as regression.agr.  Now save the project in the Desktop directory.
I will use the file name regression dot agr. 
Press Ctrl+Q  Press Control Q or Click on File, Exit to exit Grace. 
Let’s summarize.  
Slide Number 8
Summary 
In this tutorial we,

Slide Number 9
Assignment 
For assignment activity, please do the following.
(parabola1.txt & parabola2.txt)

Slide Number 10
Assignment 

Show the glimpse of assignment.  Your completed assignment may look similar to this. 
Slide Number 11
Spoken Tutorial Project 
This video summarizes the Spoken Tutorial Project.
Please download and watch it. 
Slide Number 12
Spoken Tutorial workshops 
The Spoken Tutorial Project team:
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 NMEICT, MHRD, Government of India.
More information on this mission is available at this link. 
This is Rani from IIT Bombay.
Thank you for joining. 