Difference between revisions of "Grace/C3/Data-Fitting/English"
Line 47: | Line 47: | ||
|| Hover mouse over file, '''line-fit.txt'''. | || Hover mouse over file, '''line-fit.txt'''. | ||
|| Notice the file, '''line-fit.txt'''. | || Notice the file, '''line-fit.txt'''. | ||
− | This file is provided to you in the ''' | + | This file is provided to you in the '''Code Files''' link. |
I have downloaded, extracted and saved the file to the '''Desktop''' directory. | I have downloaded, extracted and saved the file to the '''Desktop''' directory. | ||
Line 70: | Line 70: | ||
|| Move the cursor along the data points. | || Move the cursor along the data points. | ||
|| The data points do not lie on a straight line. | || The data points do not lie on a straight line. | ||
− | + | The data points look scattered around a straight line. | |
|- | |- | ||
|| Cursor on the graph. | || Cursor on the graph. | ||
− | || | + | || We will fit this data to a straight line. |
+ | |||
For a straight line, this is process is called '''linear regression'''. | For a straight line, this is process is called '''linear regression'''. | ||
Line 81: | Line 82: | ||
'''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, | ||
− | The equation has the form,y equals mx+c . | + | |
+ | The equation has the form, y equals mx+c. | ||
+ | |||
Here, m is the slope of the line and c is the intercept. | Here, m is the slope of the line and c is the intercept. | ||
Line 92: | Line 95: | ||
|| Choose '''Regression'''. | || Choose '''Regression'''. | ||
|| Choose '''Regression''' from the list. | || Choose '''Regression''' from the list. | ||
+ | |||
A '''Regression''' dialogue box opens. | A '''Regression''' dialogue box opens. | ||
Line 98: | Line 102: | ||
Choose dataset '''(S0)'''. | Choose dataset '''(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 and it is shown as ('''S0'''). | 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. | The next number is the number of points that are present in the dataset. | ||
Line 104: | Line 110: | ||
|| Choose '''linear''' for '''Type of fit'''. | || Choose '''linear''' for '''Type of fit'''. | ||
|| If many datasets are loaded more sets will be seen, in the '''Apply to set''' box. | || If many datasets are loaded more sets will be seen, in the '''Apply to set''' box. | ||
+ | |||
Choose '''linear''' for '''Type of fit'''. | Choose '''linear''' for '''Type of fit'''. | ||
Line 113: | Line 120: | ||
|| For '''restrictions''' choose '''None'''. | || For '''restrictions''' choose '''None'''. | ||
|| For '''restrictions''' choose '''None'''. | || For '''restrictions''' choose '''None'''. | ||
+ | |||
If only part of the data set needs to be fitted, enter the required range. | 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. | || Hover mouse over '''start load at''' and '''stop load at''' values. | ||
+ | |||
Click on '''Accept'''. | Click on '''Accept'''. | ||
|| We can also specify the '''start load at''' and '''stop load at''' values in the form. | || 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. | I will leave it as is and will not make changes here. | ||
Click on '''Accept''' to run the data fitting. | Click on '''Accept''' to run the data fitting. |
Revision as of 18:40, 2 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
Pre-requisites https://spoken-tutorial.org |
To follow this tutorial,
|
Slide Number 5
Data fitting |
* Data fitting is a process to find a mathematical relation between two variables.
|
Go to Desktop. | Go to Desktop. |
Hover mouse over file, line-fit.txt. | Notice the file, line-fit.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 read-sets 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. | The data points look scattered around a straight line.
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 6
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 drop-down, 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 line-regression.txt in Save to file. | In Save to file text box, type the filename as line-regression.txt. |
Click on accept and click to close. | Click on Apply and then click on Close to close the text 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. |
Right-click, 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. |
Click on Close on the spreadsheet dataset editor and cursor on the interface. | Close the Spreadsheet dataset editor.
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 drop-down. | I will retain the font type as Times-Roman. |
Click on Apply. | Click on Apply to apply the changes. |
Click on the legend tab. | 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 drop-down, 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 7
Summary |
In this tutorial, we,
|
Slide Number 8
Assignment |
For assignment activity, please do the following.
(parabola1.txt & parabola2.txt)
|
Slide Number 9
Assignment |
|
Show the glimpse of assignment. | Your completed assignment may look similar to this. |
Slide Number 10
Spoken Tutorial Project |
This video summarizes the Spoken Tutorial Project.
Please download and watch it. |
Slide Number 11
Spoken Tutorial workshops |
The Spoken Tutorial Project team:
For more details, please write to us. |
Slide Number 12
Forum for specific questions: |
Please post your timed queries in this forum. |
Slide Number 13
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. |