Both sides previous revisionPrevious revisionNext revision | Previous revision |
tutorials:t6 [2019/07/30 18:36] – [T6: Introduction to user-defined functions and variables] pwarczok | tutorials:t6 [2023/08/01 16:22] (current) – pwarczok |
---|
| |
//This tutorial was tested on\\ | //This tutorial was tested on\\ |
MatCalc version 6.02 rel 1.003\\ | MatCalc version 6.04 rel 1.001\\ |
license: free\\ | license: free\\ |
database: mc_fe.tdb// | database: mc_fe.tdb// |
Click on the lower plot, and in the **'Options'** window, edit the **'y-data'** line for the first series (**'series #0'**) of this plot. This should currently read **'X$LIQUID$C'**. Append **'*F$LIQUID'** to this - this can be done by pasting the previously copied **'F$LIQUID'** text.\\ | Click on the lower plot, and in the **'Options'** window, edit the **'y-data'** line for the first series (**'series #0'**) of this plot. This should currently read **'X$LIQUID$C'**. Append **'*F$LIQUID'** to this - this can be done by pasting the previously copied **'F$LIQUID'** text.\\ |
| |
{{:tutorials:t6:img:t6_plot_options_2014.png| MatCalc plot}} | {{:tutorials:t6:img:t6_plot_options_6050006.png| MatCalc plot}} |
| |
Repeat this process for the other series to give **'X$BCC_A2$C*F$BCC_A2'**, **'X$FCC_A1$C*F$FCC_A1'** and **'X$CEMENTITE$C*F$CEMENTITE'**. Add another variable to the plot: **'XS$C'** (can be found in the **'composition'** section), the mole fraction of carbon in the system. This should be equal to the sum of the other four variables on the plot.\\ | Repeat this process for the other series to give **'X$BCC_A2$C*F$BCC_A2'**, **'X$FCC_A1$C*F$FCC_A1'** and **'X$CEMENTITE$C*F$CEMENTITE'**. Add another variable to the plot: **'XS$C'** (can be found in the **'composition'** section), the mole fraction of carbon in the system. This should be equal to the sum of the other four variables on the plot.\\ |
Close the **'Functions & Variables'** box to return to the main screen. Expand **'functions'** in the **'Variables'** window by clicking on the small plus-sign to the left of the word. This should give a list of the new functions: | Close the **'Functions & Variables'** box to return to the main screen. Expand **'functions'** in the **'Variables'** window by clicking on the small plus-sign to the left of the word. This should give a list of the new functions: |
| |
{{:tutorials:t6:img:t6_var_func_2014.png| MatCalc variables window}} | {{:tutorials:t6:img:t6_var_func_6050006.png| MatCalc variables window}} |
| |
Make a new plot and drag and drop the functions just defined into it (To select multiple entries, hold **'Ctrl'**-key while clicking on them), together with the **'XS$C'** variable, to check that this gives the same appearance as the plot above. | Make a new plot and drag and drop the functions just defined into it (To select multiple entries, hold **'Ctrl'**-key while clicking on them), together with the **'XS$C'** variable, to check that this gives the same appearance as the plot above. |
One way of removing the unwanted part of this line is to select **'Edit series data'** from the right-click menu. In the resulting table of **'Liquid_line'** series, select all the rows for which the y-value is negative and then click on **'Delete rows/cols'** to remove them. Accept the warning with **'OK'**.\\ | One way of removing the unwanted part of this line is to select **'Edit series data'** from the right-click menu. In the resulting table of **'Liquid_line'** series, select all the rows for which the y-value is negative and then click on **'Delete rows/cols'** to remove them. Accept the warning with **'OK'**.\\ |
An alternative way is to add the series as a **'function/expression'** rather than as a **'buffer result'**. There are differences in the way the program treats these two types of series; for example, in a **'function/expression'** series, x-values are specified as a numerical range, and the y-values are functions of x, whereas for **'buffer results'**, the x-values are specified as a variable (by default, the StepValue), and the y-values as another variable.\\ | An alternative way is to add the series as a **'function/expression'** rather than as a **'buffer result'**. There are differences in the way the program treats these two types of series; for example, in a **'function/expression'** series, x-values are specified as a numerical range, and the y-values are functions of x, whereas for **'buffer results'**, the x-values are specified as a variable (by default, the StepValue), and the y-values as another variable.\\ |
When a variable is dragged and dropped from the **'variables'** window, it automatically becomes a **'buffer result'**-type series. To add a **'function/expression'** series, click on the plot, then in the options window, select **'new series'** from the right-click menu, and choose **'function/expression'**. By **'y-data'** for the new series, type in **'Liquid_line'**. Edit the **'x-data'** line to type **'x1..0.5'**. | When a variable is dragged and dropped from the **'variables'** window, it automatically becomes a **'buffer result'**-type series. To add a **'function/expression'** series, click on the plot, then in the options window, select **'new series'** from the right-click menu, and choose **'function/expression'**. By **'y-data'** for the new series, type in **'Liquid_line'**. Edit the **'x-data'** line to **'x1..0.5'**. |
| |
{{:tutorials:t6:img:t6_function_to_plot_2016.png| MatCalc function}} | {{:tutorials:t6:img:t6_function_to_plot_6050006.png| MatCalc function}} |
| |
The plot should now look as shown in the image below (with the **'Liquid_line'** series highlighted). | The plot should now look as shown in the image below (with the **'Liquid_line'** series highlighted). |