Grace/C3/Data-Fitting/English-timed

From Script | Spoken-Tutorial
Revision as of 13:07, 30 August 2022 by PoojaMoolya (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Time Narration
00:01 Welcome to the tutorial on Data fitting in Grace.
00:06 In this tutorial, we will

Fit a given set of data points to a linear equation

00:14 Add two datasets to a graph panel
00:18 Add legends and format the legend properties
00:24 To record this tutorial, I am using

Ubuntu Linux 16.04 OS

00:33 Grace 5.1.25 and Gedit 3.18.3
00:42 To follow this tutorial,

Learner must be familiar with the Grace interface.

00:48 For pre-requisite tutorials, please visit this website.
00:54 Data fitting is a process to find a mathematical relation between two variables.
01:01 An equation is used to describe the XY dataset pair.
01:06 Using an iterative process, the coefficients are optimized.
01:11 The process returns the best possible coefficients for the equation.
01:17 Go to Desktop. Notice the file, line-fit.txt.
01:24 This file is provided to you in the Code Files link.
01:29 I have downloaded, extracted and saved the file to the Desktop directory.
01:36 Next, open the Grace program and load this file to plot an XY graph.
01:43 Choose XY data set, and autoscale data.
01:48 Next I will format the plot.
01:52 I have changed the symbols, line style, tick marks and axis labels.
01:59 The data points do not lie on a straight line.
02:04 The data points look scattered around a straight line.
02:08 We will fit this data to a straight line.
02:12 For a straight line, this is process is called linear regression.
02:18 A straight line is described by an equation in two variables,
02:24 The equation has the form, y equals mx+c.
02:29 Here, m is the slope of the line and c is the intercept.
02:36 Go to Data and select Transformations.
02:42 Notice the available options.
02:46 Choose Regression from the list.
02:48 A Regression dialog box opens.
02:52 Choose the data set of interest from Apply to set.
02:58 Currently only a single set is loaded and it is shown as S0.
03:05 The next number is the number of points that are present in the dataset.
03:12 If many datasets are loaded more sets will be seen, in the Apply to set box.
03:19 Choose linear for Type of fit.
03:23 In the Load drop-down, choose Fitted values.
03:29 For restrictions choose None.
03:33 If only part of the data set needs to be fitted, enter the required range.
03:39 We can also specify the start load at and stop load at values in the form.
03:47 I will leave it as is and will not make changes here.
03:52 Click on Accept to run the data fitting.
03:56 The data fitting algorithm runs.
03:59 A Grace console window appears with mathematical details.
04:04 We can see the equation used for the fitting.
04:08 The output values of residual, slope, intercept and other parameters are seen.
04:17 The fitted line appears on the screen.
04:21 The fitted values are loaded in a different set, S1.
04:26 Click on File, Save to save the parameters.
04:31 The Grace: Save logs window opens.
04:35 In Save to file text box, type the filename as line-regression.txt.
04:43 Click on Apply and then click on Close to close the dialog box.
04:49 Close the Grace Console by File, Close or press theEsc key.
04:56 Click on Close in the Regression window.
05:00 Double click on the line in the graph.
05:03 Grace Set appearance window opens.
05:07 In the select set form, select S1 data set.

This is the fitted data.

05:15 Right click to open the context menu.
05:19 Select Edit, and in In spreadsheet option.
05:24 The Grace: Spreadsheet dataset editor appears.
05:29 Notice the x and corresponding fitted y values of the fitted data.
05:36 These values are different from the input data.
05:40 This line fits the input data best, with a linear equation.
05:46 Close the Spreadsheet dataset Editor.
05:50 The original data set and the fitted values are the 2 datasets in the graph.
05:58 Datasets are labeled as [S0] for first set and [S1] for the second set.
06:05 We can add more datasets to this graph panel.
06:10 For this load the data using the Data, import, ASCII option from the menu.
06:18 Next, we will add legends to the plot.
06:22 Open the Set Appearance window and choose the dataset S0.
06:29 Under Legend, in the String field, type Data as the legend label.

Click on Apply.

06:38 Next choose S1 dataset from the Select set data form.
06:45 Here, I will type Fitted data for the legend and click on Apply.
06:53 Close the Set Appearance window.
06:57 For some users, the legend position may be outside the graph border.
07:03 To reposition the legends, place the cursor in the legend box.
07:09 Then press Control and L keys together.
07:13 The cursor changes to a pointer.
07:17 Left click and drag the legend box to the desired position.
07:24 Then, press Enter.
07:27 Press the Escape key to exit the movement mode.
07:32 Next, open the Graph appearance window.
07:36 In the window, click on the Legends tab, to format the legend fonts.
07:43 Under the text properties, move the character size slider to 70.
07:49 The legends look very large compared to the graph.
07:53 I will retain the font type as Times-Roman.
07:58 Click on Apply to apply the changes.
08:02 Click on the legend box tab.
08:06 We can also specify the position of the legend in the location section.

I will leave it as is.

08:10 In the Frame line section, for Pattern, I will choose None.
08:22 Click on Apply.

This will remove the legend frame box.

08:28 Then Close the dialog box.
08:31 Now save the project in the Desktop directory.
08:36 I will use the file name regression dot agr.
08:41 Press Control Q or Click on File, Exit to exit Grace.
08:49 Let’s summarize.
08:51 In this tutorial we,

Performed data fitting for a straight line.

08:57 Added two datasets in the graph panel.
09:01 Added legends to the plot and Formatted the legend properties.
09:08 For assignment activity, please do the following.
09:13 Two assignment files are provided in the Code files link.
09:18 Plot them in the same graph panel.
09:22 Perform quadratic regression on the parabola1.txt file.
09:28 Load the fitted data in the graph.
09:32 Add legend strings and reposition them inside the graph panel.
09:38 Format the appearance of the three datasets to distinguish them.
09:43 Your completed assignment may look similar to this.
09:48 This video summarizes the Spoken Tutorial Project.

Please download and watch it.

09:56 The Spoken Tutorial Project team: conducts workshops and gives certificates.
10:03 For more details, please write to us.
10:07 Please post your timed queries in this forum.
10:11 Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.
10:19 More information on this mission is available at this link.
10:24 This is Rani from IIT Bombay. Thank you for joining.
­

Contributors and Content Editors

PoojaMoolya