Magic Plot

  • Upload
    deepal

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

  • 7/28/2019 Magic Plot

    1/94

    MagicPlot 2.3 User GuideCompiled from online helpon June 7, 2012

    2012, Magicplot Systems, LLCMagicPlot.com

    http://magicplot.com/wiki/magicplot_wiki_homehttp://magicplot.com/wiki/magicplot_wiki_homehttp://magicplot.com/http://magicplot.com/http://magicplot.com/wiki/magicplot_wiki_home
  • 7/28/2019 Magic Plot

    2/94

    Contents

    Overview.......................................................................................7System Requirements and First Launch.......................................................................................7Where to get the Java Virtual Machine?...................................................................................7First Launch................................................................................................................................7Opening Projects on Double Click.............................................................................................7Portable Installation..................................................................................................................8

    Getting Started: Tables, Figures, Fit Plots and Undo..................................................................8Undo/Redo and History.............................................................................................................8Where to start?...........................................................................................................................9Creating Figures and Fit Plots...................................................................................................9

    Adding New Table to Existing Folder.......................................................................................9Enter Expressions in any Numeric Field..................................................................................10

    Importing Table from Text File (ASCII).......................................................................................10

    Table Editing.................................................................................................................................. 11Displaying Column Formulas in Table......................................................................................13Fit Column Widths.....................................................................................................................13See Also.....................................................................................................................................13

    Missing Values (NaN) in Tables and Calculations.......................................................................13NaN in MagicPlot Tables..........................................................................................................14NaN in Expressions...................................................................................................................14

    Creating a Copy of Table, Fit Plot, Folder or Figure...................................................................15What Data are Plotted on the Copied Fit Plots and Figures...................................................15

    Nonlinear Curve Fitting with Fit Plot.........................................16Nonlinear Curve Fitting: Fit Plot..................................................................................................16

    Creating a Fit Plot.....................................................................................................................16Fitting Methodology................................................................................................................ 16Fit Function is a Sum of Fit Curves...........................................................................................17Setting Initial Values of Parameters........................................................................................18Guessing Peaks.........................................................................................................................19

    Parameter Locking...................................................................................................................19Parameters Joining...................................................................................................................19Weighting of Data Points Using Y Errors................................................................................19Specifying Fit Intervals.............................................................................................................20Baseline Fitting and Extraction...............................................................................................20'Data-Baseline' Table Column...................................................................................................21Viewing the Residual Plot.........................................................................................................21Fitting.........................................................................................................................................21Fitting One Curve......................................................................................................................21Why My Fit is Not Converged?.................................................................................................22

    See Also.....................................................................................................................................22

    2

  • 7/28/2019 Magic Plot

    3/94

    Fitting Algorithm and Computational Formulas........................................................................23Nonlinear Least Squares Algorithm........................................................................................23Weighting of Data Points Using Y Errors................................................................................23Iterations Stop Criteria............................................................................................................24Formulas...................................................................................................................................24See Also....................................................................................................................................26

    Joining the Parameters of Fit Curves.........................................................................................26See Also.....................................................................................................................................27

    Specifying Custom Fit Equation (Pro edition only)...................................................................28Fit Parameters..........................................................................................................................28Adjusting Parameters with Mouse Wheel..............................................................................29See Also....................................................................................................................................29

    Using Spline for Baseline Subtraction (Pro edition only).........................................................29Editing Spline............................................................................................................................29Fitting with Spline....................................................................................................................30

    See Also.....................................................................................................................................31Guessing Peaks (Pro edition only)..............................................................................................32

    Smoothing of Data and 2nd Derivative...................................................................................32The Number of Peaks...............................................................................................................32See Also.....................................................................................................................................33

    Predefined Fit Curves Equations.................................................................................................33See Also....................................................................................................................................34

    Creating x-y Table from Fit Curves.............................................................................................34

    Data Processing..........................................................................36

    Setting Column Formula..............................................................................................................36Row Index................................................................................................................................36Rows Evaluation Order............................................................................................................37Using Table Data......................................................................................................................37Auto Recalculation on Data Change.......................................................................................37Formula Menu in Column Context Menu................................................................................37Argument is out of range at row # Warning......................................................................38See Also....................................................................................................................................38

    Integration (Pro edition only).....................................................................................................38Baseline Correction..................................................................................................................39

    Formula.....................................................................................................................................39See Also....................................................................................................................................39

    Differentiation (Pro edition only)...............................................................................................39Formula....................................................................................................................................40See Also....................................................................................................................................40

    Fast Fourier Transform (FFT) (Pro edition only).......................................................................40Formulas....................................................................................................................................41Parameters...............................................................................................................................43

    Histogram Calculation (Pro edition only)...................................................................................43

    Binning Options.......................................................................................................................44

    3

  • 7/28/2019 Magic Plot

    4/94

    Auto Binning Criteria...............................................................................................................44Preview Plot.............................................................................................................................45

    Descriptive Statistics (Pro edition only).....................................................................................45Statistical Functions in Column Formulas...............................................................................45Computational Formulas.........................................................................................................45

    Calculating Integrals and Statistics (Pro) on Intervals using Fit Plot......................................46Managing Intervals..................................................................................................................47Relative Integrals Calculation..................................................................................................47Computational Formulas.........................................................................................................47See Also....................................................................................................................................48

    Transform X or Y Fit Plot Data (Pro edition only).....................................................................48See Also....................................................................................................................................48

    Formula Syntax............................................................................................................................48General Rules...........................................................................................................................49Functions..................................................................................................................................49

    Boolean Logic...........................................................................................................................50Operators..................................................................................................................................51

    Table Sorting.................................................................................................................................52Sorting Criteria.........................................................................................................................52

    Batch Processing.........................................................................53Batch Processing (Pro edition only)...........................................................................................53

    Introduction..............................................................................................................................53Capabilities................................................................................................................................53Batch Processing Steps...........................................................................................................54

    Fitting Series.............................................................................................................................58

    Visual Data Navigation...............................................................61Scale Scrolling for Data Navigation.............................................................................................61

    Do not Confuse Scale Scrolling and Image Zoom...................................................................61Current Axes.............................................................................................................................61See Also....................................................................................................................................62

    Reading Plot Data, Measuring Distances, Curves Selection.....................................................62Crosshair Cursor.......................................................................................................................62Reading Plot Data....................................................................................................................62

    Curve Context Menu................................................................................................................63Measuring Data Distances with Scale Zoom Tool..................................................................63Selecting Curves in Turn Using Keyboard..............................................................................64See Also....................................................................................................................................65

    Quick Plot Tool.............................................................................................................................65

    Editing Figures............................................................................67Adding and Arranging Axes on Figure.......................................................................................67

    Add and Arrange Axes as Table..............................................................................................68

    Adding and Arranging Curves on Figure Axes...........................................................................68

    Changing Curves Drawing Order............................................................................................68

    4

  • 7/28/2019 Magic Plot

    5/94

    Shifting Curves on Figure and Creating 2D Waterfall...............................................................70

    Using Figure Templates................................................................................................................71Saving Template from Figure..................................................................................................72Applying Template to a Figure................................................................................................72

    Drawing and Editing...................................................................73Axes Style Editing.........................................................................................................................73

    Drawing on Figures and Fit Plots, Image Zoom and Objects Selection...................................73Image Zooming (Pro edition only)..........................................................................................74Do not Confuse Scale Scrolling and Image Zoom..................................................................74Objects selection......................................................................................................................74Moving an Object Forward or Backward................................................................................75Changing Curves Order on Figure...........................................................................................75Snapping to Other Objects......................................................................................................75See Also.....................................................................................................................................75

    Colours and Opacity Adjustment................................................................................................76See Also....................................................................................................................................76

    Creating Transparent Figures and Fit Plots................................................................................76See Also.....................................................................................................................................77

    Using of Drawing Dimensions Toolbar.......................................................................................77

    Switching Curves Antialiasing on the Screen............................................................................78

    Text Labels Editing.....................................................................79Inserting Special Symbols and Greek Letters............................................................................79

    Typing Greek letters with Keyboard Shortcuts......................................................................79

    Inserting Math Symbols with Keyboard Shortcuts................................................................80Inserting Special Characters by Character Sequences..........................................................80Unicode Code Point Finding out.............................................................................................80See Also.....................................................................................................................................81

    Advanced Typography Features..................................................................................................81Ligatures Support.....................................................................................................................81Mathematical Symbols in Axes Labels....................................................................................82See Also....................................................................................................................................83

    Image Exporting and Copying....................................................84

    Image Export................................................................................................................................84Raster Image Formats.............................................................................................................84Vector Image Formats (Pro edition only)...............................................................................85Image Format Restrictions......................................................................................................85See Also....................................................................................................................................85

    Preview Image..............................................................................................................................85Preview Features.....................................................................................................................86Preview Zoom Options............................................................................................................86

    Copying Images to Clipboard (Pro edition only).......................................................................86See Also....................................................................................................................................87

    5

  • 7/28/2019 Magic Plot

    6/94

    Tools...........................................................................................88MagicPlot Calculator....................................................................................................................88

    Using the Calculator................................................................................................................88Standalone Calculator Application.........................................................................................88See Also....................................................................................................................................89

    Appendices.................................................................................90Portable Installation on USB drive.............................................................................................90

    MagicPlot Editions Comparison..................................................................................................90

    Keyboard Shortcuts.....................................................................................................................92Common Shortcuts..................................................................................................................92Table Shortcuts........................................................................................................................93Figure and Fit Plot Shortcuts...................................................................................................93

    6

  • 7/28/2019 Magic Plot

    7/94

    Overview

    System Requirements and First Launch

    MagicPlot is a cross-platform application based on Java technology. You need to install Javasoftware (Java Runtime Environment, also referred to as the Java Runtime, RuntimeEnvironment, Runtime, JRE, Java Virtual Machine, Virtual Machine, Java VM, JVM, VM) withversion not older than 6. Java 6 is also referred to as Java 1.6.

    Where to get the Java Virtual Machine?

    Microsoft Windows users:java.com

    Mac OS X users: Java is already installed. Use the Software Update feature of youroperating system if needed.

    Unix-like system users:java.com oropenjdk.java.net/install/

    If you run MagicPlot jar-file from command line, set the maximum Java heap size byspecifying the following parameters:java -Xmx1024m -jar magicplot.jar

    MagicPlot may not launch on old versions of OpenJDK Java Runtime (version 1.6.0_18 isenough) which may be installed by default on your Unix-like system. In such case updateOpenJDK Java Runtime or install JVM from java.com.

    First Launch

    MagicPlot does not need any installation procedure.

    Place MagicPlot executable file to directory you prefer.

    MagicPlot preferences and registration data are stored in your operating system profile andare individual for each account.

    Opening Projects on Double Click

    Windows

    To make Windows open your MagicPlot project files (.mppz) in MagicPlot just open contextmenu of one project file in Explorer and select Open With Choose Program item. In theopened window press Browse button and choose MagicPlotPro.exe orMagicPlotStudent.exe file. Click to select the Always use the selected program toopen this kind of file checkbox if it is not selected.

    Mac OS X

    MagicPlot project files (.mppz) will be automatically associated with MagicPlot by youroperating system.

    7

    http://en.wikipedia.org/wiki/Javahttp://en.wikipedia.org/wiki/Javahttp://java.com/http://java.com/http://openjdk.java.net/install/http://openjdk.java.net/install/http://java.com/http://java.com/http://en.wikipedia.org/wiki/Javahttp://java.com/http://java.com/http://openjdk.java.net/install/http://java.com/
  • 7/28/2019 Magic Plot

    8/94

    Portable Installation

    MagicPlot can be installed on USB-drive. See Portable Installation on USB drivefor details.

    Getting Started: Tables, Figures, Fit Plots and Undo

    MagicPlot Projects contain Tables, Figures and Fit Plots. MagicPlot Project files have .mppzextension.

    Tables contain data in various formats.

    Tables which contain associated data are located in one Folder.

    Fit Plots are intended for non-linear curve fitting and subtracting baselines.

    Figures are intended to graphically represent multiple data.

    Project tree

    Typically, you need to open, edit, process, plot and fit multiple data acquired in various

    experiments or series of experiments within single project. Ordinarily you have the source(imported) Table and a number of Tables with derivative data, such as Fourier transform orstatistics of source Table data. MagicPlot automatically creates a new Folder every time youimport new Table. All derivative data is stored in the same Folder by default. All Plots createdfrom Tables in certain Folder are stored in the same Folder.

    Close Unused Internal Windows

    Feel free to close currently unused interval windows with Tables, Figures and Fit Plots. Thedata will not be deleted, the window will be closed only. You can open the closed window bydouble clicking on component in Project tree.

    Undo/Redo and History

    MagicPlot supports unlimited depth undo/redo function with History dialog window. Historydialog supports multiple undo and redo. Undone actions are marked light gray. Last savedstate is set off in bold.

    8

    http://magicplot.com/wiki/portablehttp://magicplot.com/wiki/portablehttp://magicplot.com/wiki/portable
  • 7/28/2019 Magic Plot

    9/94

    Undo/Redo and History menu

    History dialog

    Where to start?

    In most cases you may start with importing table from text file by clicking Project Import Text Table menu item.

    Creating Figures and Fit Plots

    The easiest way to create Figure or Fit Plot is the following:

    Select two columns (x and y) in Table containing your data

    SelectCreate Figure or Create Fit Plot item in the Table context menu

    You may also use Create Figure or Create Fit Plot buttons in the toolbar.

    Adding New Table to Existing Folder

    You can add new table to existing folder by selecting New Table in Folder context menu.

    Folder context menu

    9

    http://magicplot.com/wiki/importhttp://magicplot.com/wiki/import
  • 7/28/2019 Magic Plot

    10/94

    Enter Expressions in any Numeric Field

    MagicPlot can evaluate simple expressions entered in any numeric text field (brackets aresupported, see formula syntaxfor details.) For example, you can enter 12/pi in circle widthand height fields inDimensions toolbarif you want its perimeter to be equal to 12 (rememberthatp=d, where p is perimeter and d is diameter):

    All numeric fields support expressions

    Importing Table from Text File (ASCII)

    Use Project Import Text Table menu item to import table(s) from text file(s), alsoreferred to as ASCII file(s).

    You may select multiple files in opened standard file dialog by holding Ctrl or Shift.

    If you open multiple files, you can select the file to preview in files drop-down list (in TextInput Preview frame)

    If you select incorrect file(s) by mistake, click on Open icon to open file dialog once againand select other file(s).

    You can setCreate Figure or Create Fit Plot checkbox to create Figure of Fit Plotafter importing:

    If you selectFigure, the created Figure will contain all imported data from all files

    If you selectFit Plot, one Fit Plot will be created for each imported file

    You can enlarge a part of the preview plot by selecting an area by mouse (scale box zoomtool). Use context menu of the plot to change scale zoom to default.

    F5 key reloads the text file or reloads the data from clipboard.

    10

    http://magicplot.com/wiki/formulahttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/dimensionshttp://magicplot.com/wiki/dimensionshttp://magicplot.com/wiki/dimensionshttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/dimensions
  • 7/28/2019 Magic Plot

    11/94

    Import wizard dialog

    Table EditingIn MagicPlot Tables are used to store numeric or text data depending on column type(numeric/text).

    Data Types

    MagicPlot supports these data types in Tables:

    Format Description

    Numeric 64-bit double precision floating-point numbers (IEEE 754)

    Text Unicode string with unlimited length

    Notes:

    Data type is set for entire columns. One column may not contain data with different types.

    Empty cells are equivalent to Not-a-Number values.

    11

    http://en.wikipedia.org/wiki/IEEE754http://magicplot.com/wiki/nanhttp://en.wikipedia.org/wiki/IEEE754http://magicplot.com/wiki/nan
  • 7/28/2019 Magic Plot

    12/94

    Values from text columns are treated as empty cells if used as numbers.

    Table Context Menu

    Table editing functions are available in table context menu (right click to open).

    Table context menu

    Changing Column Type

    Use Set Column Type menu in column context menu to change column type (numeric/text).

    Columns Numbers

    Columns are enumerated starting with 1. The first 26 columns are additionally denoted with

    Latin letters: A, B, C, Y, Z, 27, 28, 29, . You can use either numbers or letters,addressing cells and columns in formulas.

    Renaming Columns

    Double click on column header to rename table column. You can also use Rename Columncontext menu item or press F4.

    Moving (Reordering) Columns

    Hold Alt key (Option on Mac, Meta/Win on Unix-like) and drag column header to rearrange

    table columns. IfAlt key is not pressed, mouse dragging on header will select the columns.

    12

  • 7/28/2019 Magic Plot

    13/94

    Editing Table

    You can edit table cell by double clicking on it. You can enter either a number or an expression(e.g. typing pi in a cell results in 3.1416, typing 1+2 results in 3).

    See Formula Syntax section for expression syntax.

    Displaying Column Formulas in Table

    MagicPlot marks columns for which formulas or other evaluators (FFT, integral, etc.) are setwith blue header color. You can see the formula in column header tool tip.

    The columns which are auto recalculated are not editable and have green background insteadof white.

    Table header highlighting

    On the screenshot above:

    Column A has no formula

    Column B has a formula, auto recalculation is off

    Column C has a formula, auto recalculation is on, so this column is not editable

    Fit Column Widths

    To fit the width of one column, double click on right separator line in table header. To fitseveral selected columns widths, double click on one of column separators in table header.

    See Also

    Setting Column Formula

    Formula Syntax

    Table Sorting

    Missing Values (NaN) in Tables and Calculations

    Missing Values (NaN) in Tables and CalculationsIn computing, NaN, which stands for Not a Number, is a value or symbol that is usuallyproduced as a result of an operation on invalid input operands. For example, most floating-

    13

    http://magicplot.com/wiki/formulahttp://magicplot.com/wiki/set_column_formulahttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/sortinghttp://magicplot.com/wiki/nanhttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/set_column_formulahttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/sortinghttp://magicplot.com/wiki/nan
  • 7/28/2019 Magic Plot

    14/94

    point units are unable to explicitly calculate the square root of negative numbers, and willinstead indicate that the operation was invalid and return a NaN result.

    An invalid operation is not the same as an arithmetic overflow (which returns a positive ornegative infinity). Arithmetic operations involving NaN always produce NaN, allowing thevalue to propagate through a calculation so that errors can be detected at the end withoutextensive testing during intermediate stages. A NaN does not compare equal to any number orNaN.

    How does a NaN appear?

    There are three kinds of operations which return NaN:

    1. Operations with a NaN as at least one operand, e.g. 1+NaN

    2. Indeterminate forms

    Divisions 0/0, /, /-, -/, -/-

    Multiplications 0*, 0*(-)

    Power 1^

    Additions +(-), (-)+ and equivalent subtractions.

    3. Real operations with complex results

    Square root of a negative number

    Logarithm of a negative number

    Tangent of an odd multiple of 90 degrees (or /2 radians)

    Inverse sine or cosine of a number which is less than -1 or greater than +1.

    Examples

    Expression Result

    0^0 1

    0/0 NaN

    sqrt(-1) NaN

    1/0 Infinity

    -1/0 -Infinity

    NaN in MagicPlot Tables

    In MagicPlot NaN is also used to represent empty cells in Tables.

    Statistical functions ignore NaN values in Tables.

    NaN in Expressions

    You can use predefined constants NaN, nan or NAN in expressions to specify NaN value.

    14

    http://magicplot.com/wiki/tablehttp://magicplot.com/wiki/tablehttp://magicplot.com/wiki/table
  • 7/28/2019 Magic Plot

    15/94

    Example

    If you set a Column Formulaif(col(B) >= 0, col(B), NaN) , it will return only positivevalues from column B. Negative values are replaced with NaN value. You can use thisexpression to filter negative values if you do not want to use them in future calculations.Note thatNot-a-Number returned at row #warning can be shown for such expressions.

    Creating a Copy of Table, Fit Plot, Folder or FigureYou can create a full copy of selected project components (Tables, Fit Plots, Folders, Figures)by selecting Create a Copy item on context menu.

    'Create a Copy' menu item

    What Data are Plotted on the Copied Fit Plots and Figures

    If the only Fit Plots and Figures are selected for creating a copy, the created Fit Plots andFigures will use data from the same tables and columns as initial ones. If you select also theTables which contain plotted data, then the created Fit Plots and Figures will use data fromcreated copies of these Tables.

    15

    http://magicplot.com/wiki/set_column_formulahttp://magicplot.com/wiki/set_column_formula
  • 7/28/2019 Magic Plot

    16/94

    Nonlinear Curve Fitting with Fit Plot

    Nonlinear Curve Fitting: Fit Plot

    Creating a Fit Plot

    Nonlinear least squares data fitting can be performed using Fit Plot. To create a Fit Plot, selectyour X and Y columns in Table, then selectTable Create Fit Plot in main menu, or usethe same item in Table context menu, or use Create Fit Plot button in the toolbar.

    Creating Fit Plot using Table context menu

    MagicPlot has been verified with NIST Datasets

    National Institute of Standards and Technology (NIST) has created Statistical ReferenceDatasets Project which includes 26 datasets for testing the nonlinear fit algorithms. MagicPlothas been successfully tested on these datasets. If you want to run these tests on yourcomputer download and open this MagicPlot project file: MagicPlotNIST.mppz.

    Fitting Methodology

    'Nonlinear' means here that analytical fitting function depends nonlinearly on varyingparameters (fit parameters). Fit procedure iteratively varies the parameters of fit function tominimize the residual sum of squares. Nonlinear fitting algorithm needs the user to set theinitial values of fit parameters.

    To fit the data, implement these steps:

    1. Create a Fit Plot, specify Y errors in Fit Plot properties, if any

    2. Specify fit function by adding Fit Curves

    16

    http://www.itl.nist.gov/div898/strd/nls/nls_main.shtmlhttp://magicplot.com/downloads/dwnld.php?file=MagicPlotNIST.mppzhttp://magicplot.com/downloads/dwnld.php?file=MagicPlotNIST.mppzhttp://www.itl.nist.gov/div898/strd/nls/nls_main.shtmlhttp://magicplot.com/downloads/dwnld.php?file=MagicPlotNIST.mppz
  • 7/28/2019 Magic Plot

    17/94

    3. Specify initial values of fit parameters (drag curves or enter accurate values)

    4. Specify used X data interval

    5. Run fitting

    You can undo fit and also undo changing initial parameters as any other action using Undofunction. It is a handy feature when experimenting with different models and initial

    parameters.

    Further reading

    This manual does not completely cover the complex nonlinear fitting methodology. Werecommend you to take a look at this book:

    H. Motulsky and A. Christopoulos, Fitting Models to Biological Data Using Linear andNonlinear Regression: A Practical Guide to Curve Fitting. 2003, GraphPad Software Inc., SanDiego CA, graphpad.com. PDF is available for free here.

    Fit example

    Fit Function is a Sum of Fit Curves

    MagicPlot considers fit function as a sum of Fit Curves. Ordinarily in peaks fitting each FitCurve corresponds to one peak in experimental data. Click the Add button to add new FitCurve to the list. There is a number of predefined Fit Curves types (Line, Parabola, Gauss,Lorentz, etc.) You can also create a Custom EquationFit Curve and manually enter the formula(Pro edition only). Baseline fitting components may be added to the fitting sum, too.

    Fit Plot window contains the list of Fit Curves. Each Fit Curve in the list has three checkboxes:

    17

    http://www.graphpad.com/manuals/prism4/RegressionBook.pdfhttp://www.graphpad.com/manuals/prism4/RegressionBook.pdfhttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/custom_fit_equationhttp://www.graphpad.com/manuals/prism4/RegressionBook.pdfhttp://magicplot.com/wiki/custom_fit_equation
  • 7/28/2019 Magic Plot

    18/94

    Fit Curves table

    Show: Specifies whether to show this Fit Curve on plot. Active only if Baseline checkbox isnot set

    Baseline: Toggles the subtracting of this Fit Curve from experimental data. You also canuse Residual button to subtract all Fit Sum from data

    Sum: Specifies whether to use this Fit Curve in sum fit function

    Below the Fit Curves list is a parameters table which shows names, values, and descriptions of

    parameters relating to selected Fit Curve.

    Fitting by Sum and Fitting One Curve

    MagicPlot allows two alternatives buttons to run the fit:

    Fit by Sum button will fit the data with the sum of Fit Curves for which the Sum checkboxis set. Data interval from Fit Interval tab will be used. This button must be used forexample to fit the spectrum with the sum of peaks.

    Fit One Curve button will fit the data with the one currently selected Fit Curve.Individual interval for each Fit Curve will be used. Set Edit Interval checkbox to edit

    individual interval for each Fit Curve.

    Copying and Pasting Fit Curves

    You can copy and paste Fit Curves from one Fit Plot to another Fit Plot or Figure. You can alsopaste the copied Fit Curves to the same Fit Plot to create a copy.

    The copy of Fit Curves with the same parameters and styles will be created if you paste FitCurves to a Fit Plot.

    A link to the source Fit Curves will be inserted if you paste Fit Curves in a Figure.

    Fit Curves Reordering

    You can reorder Fit Curves by dragging them in table. The data curve is always drawn the firstand fit sum is drawn the last.

    Setting Initial Values of Parameters

    Nonlinear fitting assumes that certain initial values of parameters are set before fitting. Thisprocedure is very easy if you use Fit Curves of predefined types (not custom equation): youcan drag curves on plot. Initial parameters values for each Fit Curve can also be set in

    parameter table.

    18

  • 7/28/2019 Magic Plot

    19/94

    Moving curves with mouse

    Adjusting Parameters with Mouse Wheel

    You can adjust Parameters in table using mouse wheel scrolling when mouse cursor is on the

    desired parameter: Hold Ctrl key (Cmd key on Mac) and scroll. If Shift key is also pressed theparameter step for one wheel 'click' will be increased.

    Guessing Peaks

    If you are fitting a spectrum with multiple peaks, MagicPlot may automatically add andapproximately locate peaks before fitting (Pro edition only). See Guessing Peaks (Pro editiononly) for details. Guessed peaks should be used only as the initial estimate for fitting.

    Parameter Locking

    You can lock (fix) parameter(s) to prevent varying this parameter(s) during fit and to preventits changing due to setting initial values by mouse dragging (for built-in functions). Set thecheckbox in Lock column in parameters list to lock parameter.

    Table of Parameters

    Parameters Joining

    MagicPlot allows joining (sometimes referred to as coupling, binding, linking) of fitparameters of different Fit Curves. See Joining the Parameters of Fit Curvesfor details.

    Weighting of Data Points Using Y Errors

    MagicPlot allows data points weighting with Y error data. You can specify Y error data in FitPlot properties dialog. If no Y error data are specified weighting is not used.

    Weights are calculated as 1 / Yerror2 for every point. See Fitting Algorithm and

    Computational Formulas for details.

    19

    http://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/joininghttp://magicplot.com/wiki/joininghttp://magicplot.com/wiki/fit_formulashttp://magicplot.com/wiki/fit_formulashttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/joininghttp://magicplot.com/wiki/fit_formulashttp://magicplot.com/wiki/fit_formulas
  • 7/28/2019 Magic Plot

    20/94

    Weights must be positive and finite for all points so the Y error values must be positive andnon-zero (to prevent infinite weights). MagicPlot checks this condition before fitting andshows an error message if Y errors cannot be used to compute weights.

    Specifying Fit Intervals

    You can set the X intervals of the data which will be used for fitting. Data points outside theseintervals are not used to compute the minimizing residual sum of squares. You can use thisfeature if some data points (especially in the beginning or the end) are inaccurate, e.g. noisy.

    SelectFit Interval tab to set intervals visually or edit accurate borders values in table.

    Double click on interval to split it

    Drag the interval border to move it. If intervals intersect, they will be merged

    Use context menu on the plot to create, delete and split intervals

    Note: Data intervals from Fit Interval tab are used for fitting Sum only. To set individual

    data intervals for the one Curve fitting use Edit Interval checkbox.

    Fit interval context menu

    Baseline Fitting and Extraction

    Fit Interval is also usable when baseline fitting. Before baseline fitting you can specify theinterval which does not contain any signal points and contains baseline only. Set Baselinecheckboxes at baseline Fit Curves after baseline fitting to subtract baseline from data. Thenspecify the whole interval and fit the data.

    Note that if you use data processing (integration, FFT, etc.) on Fit Plot, then the differencebetween the data and baseline curves (which you do see on the plot) will be processed. Youcan use this behaviour to exclude baseline from data before integrating, see Integration (Proedition only) for more information.

    20

    http://magicplot.com/wiki/integrationhttp://magicplot.com/wiki/integrationhttp://magicplot.com/wiki/integrationhttp://magicplot.com/wiki/integration
  • 7/28/2019 Magic Plot

    21/94

    'Data-Baseline' Table Column

    The 'Data-Baseline' column is appended to the Table with initial (X and Y) data when youcreate a Fit Plot. The 'Data-Baseline' column contains the difference between initial Y data andbaseline approximation (the sum of Fit Curves for which Baseline checkbox is set). It is'Data-Baseline' column that is actually plotted on Fit Plot as data.

    Use 'Data-Baseline' column in Table if you want to process the data without baseline. Thiscolumn is also used as initial data if you use Processing menu when Fit Plot is active.

    Viewing the Residual Plot

    Residual means here the difference between initial data, baseline function and Fit Sumfunction. MagicPlot offers two different ways to view the residual:

    Press and hold the Residual button. The residual will be shown while button is pressed.You can use either mouse or space key (if button is selected) to hold Residual button.

    You can either setBaseline checkboxes for all summed Fit Curves to subtract them fromdata and explore the residual plot

    Fitting

    To execute the fit click the Fit by Sum button ofFit One Curve button (see below).

    MagicPlot indicates fit process with a special window. Fitting curves are periodically updatedon plot while fitting so you can see how fit converges.

    Fit progress window

    MagicPlot shows current iteration number and deviation decrement with two progress barswhile fit is performed. The fit process stops when one of these progress bars reaches the end.

    You can see two buttons on fit progress window: Break Iterations: Breaks iterations after current iteration. Use this button if you suspect

    that further iterations will not change the result.

    Undo Fit: Breaks iterations and reverts fit parameters to their initial (before fit) values.Use this button if you see that fit process converges to wrong result; change initial values ofparameters and run fit again.

    Fitting One Curve

    You can use MagicPlot to fit the data with single selected Fit Curve by pressing Fit One

    Curve button. In this case a specific data interval for each Fit Curve is used and the main

    21

  • 7/28/2019 Magic Plot

    22/94

    fitting data interval (from Fit Interval tab) is ignored. SelectEdit Interval checkbox inthe bottom of the Fit Plot panel to set specific fit intervals for each Fit Curve.

    Because of using individual data interval this method is useful for baseline fitting. In order tofit baseline specify the intervals which does not contain signal (peaks) and contain only noise.

    'Fit One Curve' button

    Why My Fit is Not Converged?

    In some cases the fit procedure may fail to find the optimal parameters values. The actualmathematical reason for this error is impossibility to invert the matrix calculated frompartial derivatives of fit function with respect to fit parameters. This inverted matrix is used tocompute the new values of parameters for next step of fit (like gradient descent). In mostcases this error occurs when the matrix is ill-conditioned or nearly singular and the inversecannot be calculated accurately enough with used floating-point arithmetic.

    The origin of this error may be:

    Fit is not converged through one or more parameters: some parameters were takingunrealistically great values during iterations. There are no local minimum of residual sumof squares near the initial values of these parameters. MagicPlot highlights the suspiciousFit Curve in this case.

    Mutual dependency exists between some parameters. The algorithm cannot resolve whichparameter to vary.

    Fit function is ill-conditioned: the minimized residual sum of squares depends on someparameters much more than on other ones.

    Try one of the following:

    Specify more accurate initial values of parameters. Simplify the fit function (e.g. remove some peaks).

    Lock some parameters.

    See Also

    Fitting Algorithm and Computational Formulas

    Specifying Custom Fit Equation (Pro edition only)

    Using Spline for Baseline Subtraction (Pro edition only)

    22

    http://magicplot.com/wiki/fit_formulashttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/fit_formulashttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/spline
  • 7/28/2019 Magic Plot

    23/94

    Joining the Parameters of Fit Curves

    Guessing Peaks (Pro edition only)

    Predefined Fit Curves Equations

    Transform X or Y Fit Plot Data (Pro edition only)

    Calculating Integrals and Statistics (Pro) on Intervals using Fit Plot

    Creating x-y Table from Fit Curves

    Fitting Algorithm and Computational Formulas

    MagicPlot uses iterative LevenbergMarquardtnonlinear least squares curve fitting algorithmwhich is widely used in most software.

    MagicPlot fitting procedure takes all advantages of multi-core processors.

    Nonlinear Least Squares AlgorithmFit procedure iteratively varies the parameters

    kof fit functionf(x,

    1, ,

    p) to minimize the

    residual sum of squares (RSS,2):

    here:

    xi andyi are the data points, Nis total number of points,

    f(x, 1,,p) is the fit function which depends on value ofxand fit parametersk,

    p is the number of fit parametersk,

    wiare normalized (w

    i= 1) data weighting coefficients for each point (x

    i, y

    i).

    An initial guess for the parameters has to be provided to start minimization. Calculation of thenew guess of parameters on each fit iteration is based on the fit function partial derivatives

    for current values of fit parameters and for each x value:

    Partial derivatives are computed using explicit formulas (for some predefined fit functions) orwith finite difference (for custom equations).

    Weighting of Data Points Using Y Errors

    MagicPlot can use weighting ofyvalues based on y errors si:

    If standardyerrors are notspecified: all wi=1

    23

    http://magicplot.com/wiki/joininghttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/fit_equationshttp://magicplot.com/wiki/transform_xyhttp://magicplot.com/wiki/interval_statisticshttp://magicplot.com/wiki/table_from_curveshttp://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithmhttp://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithmhttp://en.wikipedia.org/wiki/Non-linear_least_squareshttp://magicplot.com/wiki/joininghttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/fit_equationshttp://magicplot.com/wiki/transform_xyhttp://magicplot.com/wiki/interval_statisticshttp://magicplot.com/wiki/table_from_curveshttp://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithmhttp://en.wikipedia.org/wiki/Non-linear_least_squares
  • 7/28/2019 Magic Plot

    24/94

  • 7/28/2019 Magic Plot

    25/94

    width at half maximum.

    Number of fitfunctionparameters

    This is the total number of parameters of all fitcurves which are summarized to fit.

    Degrees offreedom

    Estimated meanof data

    Estimatedvariance of data

    Not used by fit algorithm, only for comparison.

    Data total sum ofsquares, TSS

    TSS TSS is also called sum of squares about the meanand acronym SST is also used.

    Fit ResultResidual sum ofsquares, RSS

    This value is minimized during the fit to find theoptimal fit function parameters.RSS is also called the sum of squared residuals

    (SSR), the error sum of squares (ESS), the sum of

    squares due to error (SSE).

    Reduced2 The advantage of the reduced chi-squared is thatit already normalizes for the number of datapoints and model (fit function) complexity.

    Reduced 2 is also called mean square error

    (MSE) or the residual mean square.

    Residual

    standarddeviation

    s Standard deviation is also called root mean

    square of the error (Root MSE)

    Coefficient ofdetermination

    R2 will be equal to one if fit is perfect, and tozero otherwise. This is a biased estimate of the

    population R2, and will never decrease ifadditional fit parameters (fit curves) are added,even if they are irrelevant.

    Adjusted R2 Adjusted R2 (or degrees of freedom adjusted R-

    square) is a slightly modified version ofR2,designed to penalize for the excess number of fitparameters (fit curves) which do not add to the

    explanatory power of the regression. Thisstatistic is always smaller than R2, can decreaseas you add new fit curves, and even be negativefor poorly fitting models.

    Covariancematrix ofparameters

    k

    Here is the matrix of partial derivatives of fitfunction with respect to parameters

    mand

    n

    which is used for fitting:

    25

    http://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)http://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)http://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)http://en.wikipedia.org/wiki/Coefficient_of_determinationhttp://en.wikipedia.org/wiki/Coefficient_of_determinationhttp://en.wikipedia.org/wiki/Coefficient_of_determinationhttp://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)http://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)http://en.wikipedia.org/wiki/Coefficient_of_determinationhttp://en.wikipedia.org/wiki/Coefficient_of_determination
  • 7/28/2019 Magic Plot

    26/94

    Standarddeviation ofparameters

    k,

    std. dev.

    These values are displayed in Std. Dev.column in parameters table.

    Correlationmatrix ofparameters

    k

    This matrix has 1's on diagonal.

    See Also

    Nonlinear Curve Fitting: Fit Plot

    Specifying Custom Fit Equation (Pro edition only)

    Using Spline for Baseline Subtraction (Pro edition only)

    Joining the Parameters of Fit Curves

    Guessing Peaks (Pro edition only)

    Predefined Fit Curves Equations

    Transform X or Y Fit Plot Data (Pro edition only)

    Calculating Integrals and Statistics (Pro) on Intervals using Fit Plot

    Joining the Parameters of Fit Curves

    In some cases you may want to fit the data with two peaks with the same amplitude forexample. You can do this in two ways: by specifying custom Fit Curve with your equation orbyjoining the 'amplitude' parameters of two peaks.

    Joining parameters example

    26

    http://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/joininghttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/fit_equationshttp://magicplot.com/wiki/transform_xyhttp://magicplot.com/wiki/interval_statisticshttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/joininghttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/fit_equationshttp://magicplot.com/wiki/transform_xyhttp://magicplot.com/wiki/interval_statistics
  • 7/28/2019 Magic Plot

    27/94

    To join parameters of two or more Fit Curves select one of desired Fit Curves, then selectdesired parameter in parameters table and press Join button in the bottom of the panel (ordouble click on parameter). You can specify the selected parameters as equal or proportionalby entering multiplier and constant for each parameter. Joined parameters are shown withblue color (instead of black) in curve parameters table in Fit Plot window. Joined parametersare treated as one parameter when fitting, so joining results in the reducing of actual model

    parameters number.In the example above the areas and widths of tho peaks are joined and are equal. Thepositions of maximums are joined and inverse: -1 multiplier is set to the width of Curve 3.

    Joining the areas of two peaks

    Joining the positions of two peaks

    See Also

    Nonlinear Curve Fitting: Fit Plot

    27

    http://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/fitting
  • 7/28/2019 Magic Plot

    28/94

    Specifying Custom Fit Equation (Pro edition only)

    To specify custom fit function formula, press Add button and select Custom Equation inpopup menu.

    Enter your formula in y(x)= text field below. Use x as fit function argument. See formulasyntax for details.

    You may recall last entered custom fit functions using Recently Used Custom item in Addpopup menu.

    Custom fit function example

    Fit Parameters

    You can introduce Fit Curve parameters with any names except argument x, and constantslike e, pi (see predefined constants for details):

    Parameters names are case-sensitive (a and A are different parameters).

    Parameters names lengths are not limited.

    Begin names with letter or _ sign. You can use numbers in the middle or in the end of thename: a1, a_1, A1, a1t, but the names like 1a are not allowed.

    The parameters you introduce in formula will automatically and immediately occur inparameters list, you do not need to enter parameters names in the list manually. Random

    28

    http://magicplot.com/wiki/formulahttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/formula#constantshttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/formula#constants
  • 7/28/2019 Magic Plot

    29/94

    values are used as the initial values of parameters. Do not forget to set more relevant initialvalues, otherwise fit algorithm may fail.

    Adjusting Parameters with Mouse Wheel

    You can adjust Parameters in table using mouse wheel scrolling when mouse cursor is on the

    desired parameter: Hold Ctrl key (Cmd key on Mac) and scroll. If Shift key is also pressed theparameter step for one wheel 'click' will be increased.

    See Also

    Nonlinear Curve Fitting: Fit Plot

    Using Spline for Baseline Subtraction (Pro edition only)

    Predefined Fit Curves Equations

    Using Spline for Baseline Subtraction (Pro edition only)You can use cubic spline to subtract baseline on Fit Plot. To create spline curve click on Addbutton in Fit Curves tab of Fit Plot and selectSpline menu item.

    Do not use splines to subtract baselines which can be fit well enough with Line curve (line orconstant baseline). You may mistakenly subtract wide peaks using spline. In some casesParabola curve may be more suitable.

    Editing Spline

    Created spline has three anchor points by default. You can move, add and remove anchorpoints:

    Move anchor point with mouse

    Double click on spline curve to add new anchor point

    Double click on anchor point to remove it

    SetBaseline checkbox in spline row in fit curves table to subtract spline from data.

    29

    http://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/fit_equationshttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/fit_equations
  • 7/28/2019 Magic Plot

    30/94

    Using spline for baseline fitting

    Fitting with Spline

    Spline anchor point (x,y) coordinates are treated as fit parameters so you can perform fittingwith spline although we don't recommend this technique. Fitting the baseline with someadequate model function is preferred.

    It is recommended to set appropriate fit intervals which contain only baseline without peaks.In such case Fit One Curve button is more acceptable than Fit by Sum button, because

    the individual interval for current curve will be used and the interval from Fit Interval tab(which is used to fit by sum of curves) is ignored. Select spline curve and set Edit Intervalcheckbox in the bottom of the panel to edit spline interval, then click on Fit One Curvebutton. The anchor point coordinates will be varied but the number of points will remain. Youalso can lock some parameters (usually x coordinates) by setting Lock checkboxes inparameters table.

    30

  • 7/28/2019 Magic Plot

    31/94

    Setting Fit Interval for spline curve

    Spline subtraction result

    See Also

    Nonlinear Curve Fitting: Fit Plot

    Specifying Custom Fit Equation (Pro edition only)

    Guessing Peaks (Pro edition only)

    Predefined Fit Curves Equations

    31

    http://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/fit_equationshttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/fit_equations
  • 7/28/2019 Magic Plot

    32/94

    Guessing Peaks (Pro edition only)

    MagicPlot can approximately locate peaks in spectrum. To locate peaks click on Guess buttonin Fit Curves tab of Fit Plot. Peak guessing is performed by looking for local minimums ofsecond derivative of data-baseline.

    When Guess Peaks window is open you can see the preview of guessed peaks on Fit Plot.This preview is updated every time you change the parameters in the window.

    Guess peaks dialog

    Smoothing of Data and 2nd Derivative

    Smoothing is used in order to filter narrow peaks which can be guessed from noise. MagicPlot

    peak guess tool is capable of smoothing both data and second derivative before finding localminimums. Smoothing is used only to find peaks and does not affect the data on Fit Plot.

    SavitzkyGolay method is used for smoothing. This algorithm performs a local polynomialregression of specified degree on specified number of points. The more points, the smootheris curve.

    The Number of Peaks

    MagicPlot sorts found peaks by amplitude and suggests only a specified number of greatestpeaks. You can change the number of guessed peaks with slider or by entering value in thetext field with spinner.

    32

    http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_smoothing_filterhttp://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_smoothing_filter
  • 7/28/2019 Magic Plot

    33/94

    See Also

    Nonlinear Curve Fitting: Fit Plot

    Specifying Custom Fit Equation (Pro edition only)

    Using Spline for Baseline Subtraction (Pro edition only)

    Predefined Fit Curves Equations

    Predefined Fit Curves EquationsAll predefined Fit Curves are listed in this table. You also can specify custom fit equation.Unlike custom fit equations these curves can be adjusted with mouse on Fit Plot.

    Name Formula Parameters meaning AdditionalProperties

    Line a linearb constant

    Parabola a quadraticb linearc constant

    Vertex:

    Spline Natural cubic spline,on each i-th piece:

    xN anchor point x-coordinates

    yN anchor point y-coordinates

    Gaussian a amplitudedx half width at half

    maximum (HWHM)x0 maximum position

    Area (integral):

    Standard deviation:

    Gaussian-A(area-normalized)

    a area (integral)dx half width at halfmaximum (HWHM)

    x0 maximum position

    Amplitude:

    Standard deviation:

    Lorentzian a amplitudedx half width at halfmaximum (HWHM)

    x0 maximum position

    Area (integral):

    Lorentzian-A(area-normalized)

    a area (integral)dx half width at halfmaximum (HWHM)

    x0 maximum position

    Amplitude:

    33

    http://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/fit_equationshttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/custom_fit_equationhttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/fit_equationshttp://magicplot.com/wiki/custom_fit_equation
  • 7/28/2019 Magic Plot

    34/94

    GaussDerivative

    Parameters are thesameas for original Gaussian:

    a amplitudedx half width at halfmaximum (HWHM)

    x0 center position

    Area of originalGaussian(second integral):

    Standard deviation:

    Peak-to-peakhorizontal:

    Peak-to-peakvertical:

    Lorentz

    Derivative

    Parameters are the

    sameas for originalLorentzian:

    a amplitudedx half width at halfmaximum (HWHM)

    x0 center position

    Area of original

    Lorentzian(second integral):

    Peak-to-peakhorizontal:

    Peak-to-peakvertical:

    See Also

    Nonlinear Curve Fitting: Fit Plot

    Using Spline for Baseline Subtraction (Pro edition only)

    Guessing Peaks (Pro edition only)

    Creating x-y Table from Fit CurvesFit Curves and Fit Sum are treated as function equations in MagicPlot Fit Plots. But in some

    cases (e. g. to export and plot fit data with other application) you may want to create (x, y)table with Fit Curves y-values. For this purpose use Tools Create Table from Curvesmenu item when Fit Plot is active. This dialog is also available for Figures.

    You can either add new Table to a Folder in current Project or export table to a text file.

    34

    http://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/guess_peakshttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/guess_peaks
  • 7/28/2019 Magic Plot

    35/94

  • 7/28/2019 Magic Plot

    36/94

    Data Processing

    Setting Column Formula

    There are two ways to set formula for column evaluation:

    1. Select column and write formula in formula string.

    2. Use Table Set Column Formula menu item to open column formula dialog window.See formula syntax for details.

    Set column formula dialog

    Row Index

    Variable i contains the current row index. Rows are enumerated from 1.

    36

    http://magicplot.com/wiki/formulahttp://magicplot.com/wiki/formula
  • 7/28/2019 Magic Plot

    37/94

    Rows Evaluation Order

    Rows are always evaluated one after another from the first to the last in the specified range.Accordingly the row number i is incremented after each step.

    Example

    You can use this behavior to calculate factorial: set1 in the first row of column A and afterthat set formula cell(A, i-1) * i and rows interval from 2 to 100. Note that formula isto be set for rows beginning from the second, and not from the first. You will get thefactorial of row number (i).

    Using Table Data

    There are two functions to obtain current table cell values in formula:

    col(A) returns the value of cell in column A in the current (i-th) row. Equivalent tocell(A, i).

    cell(A, 3) returns the value in column A and row 3.

    You can use either upper-case letters (AZ, e.g. col(B)) or numbers (1, 2, 3,.., e.g.col(1)) in columns numeration in arguments ofcol and cell functions.

    Example

    col(A) + 15 + cell(B, i+1)

    Auto Recalculation on Data Change

    MagicPlot can automatically recalculate formula when data in used columns are changed. SetAuto Recalculate checkbox to enable this feature.

    Example

    Set formula col(A)*2 for column B and setAuto Recalculate checkbox. Column B willbe recalculated if you change values in column A or column A is updated by other formulaor processing algorithm (e.g. integral, derivative of other column).

    Formula Menu in Column Context Menu

    You can edit column formula and change auto recalculation mode from column context menuor menu Table. Select exactly one column and open context menu to view this menu items.

    37

    http://en.wikipedia.org/wiki/factorialhttp://en.wikipedia.org/wiki/factorial
  • 7/28/2019 Magic Plot

    38/94

    Formula Menu

    Argument is out of range at row # Warning

    Some mathematical functions can be defined only on a certain interval. For example, squareroot (sqrt(x)) is not defined for negative numbers (all calculations in MagicPlot are made in

    real numbers, not complex). Hence if the argument ofsqrt is negative, a Not-a-Number (NaN)is returned. If a NaN value occurs in some part of formula, the result of calculation will also bea NaN, and corresponding table cells will be empty.

    The calculations are not terminated if NaN value occurs in some row(s).

    In some cases you may want to check if a NaN values occurs in calculations. MagicPlot showsthe warning Argument is out of range at row #. This row number is the firstrow in whichNaN value was returned. MagicPlot also highlights the function or operator which firstproduces NaN value.

    See Also

    Formula syntax

    Integration (Pro edition only)Open Table or Figure or Fit Plot with initial data and selectProcessing Integrate menuitem.

    38

    http://magicplot.com/wiki/nanhttp://magicplot.com/wiki/formulahttp://magicplot.com/wiki/nanhttp://magicplot.com/wiki/formula
  • 7/28/2019 Magic Plot

    39/94

    Integrate table columns dialog

    Integrate curve dialog

    Baseline Correction

    If your initial data to be integrated contains a baseline (usually constant or linear), you maywant to subtract it from data before integrating. (A constant baseline will result in linearlygrowing integral.)

    In such case the algorithm may be the following:

    1. Create Fit Plot with your initial table data

    2. Add a Fit Curve which simulates the baseline. You may specify a custom equation (Proedition only)

    3. Specify Fit Interval so that it contains only noise points

    4. Fit the data by clicking Fit Sum button

    5. Subtract the baseline fitting curve from data by checking Baseline checkbox in curves list

    6. Use menu Processing Integrate to integrate the plotted data without baseline.

    Formula

    To perform integration you should specify two columns:xandy. Missing values are ignored.

    MagicPlot usestrapezoidal ruleto compute the integral:

    See Also

    Differentiation (Pro edition only)

    Differentiation (Pro edition only)

    Open Table or Figure or Plot with initial data and use Processing Differentiate menuitem.

    39

    http://en.wikipedia.org/wiki/Trapezoidal_rulehttp://en.wikipedia.org/wiki/Trapezoidal_rulehttp://en.wikipedia.org/wiki/Trapezoidal_rulehttp://magicplot.com/wiki/differentiationhttp://en.wikipedia.org/wiki/Trapezoidal_rulehttp://magicplot.com/wiki/differentiation
  • 7/28/2019 Magic Plot

    40/94

    Differentiate table columns dialog

    Differentiate curve dialog

    Formula

    To perform differentiation you should specify two columns: x and y. Missing values areignored.

    MagicPlot usescentral difference formula to compute the derivative:

    First and last points (i=1 and i=N) are computed as follows:

    See Also

    Integration (Pro edition only)

    Fast Fourier Transform (FFT) (Pro edition only)Open Table or Figure or Plot with initial data and use Processing Fast FourierTransform menu item to performFFT.

    Fast Fourier transform algorithm computes discrete Fourier transform exactly and is used toconsiderably speed up the calculations.

    Note that FFT is not an approximate method of calculation.

    MagicPlot uses the algorithm of FFT that does not necessarily require the number of points Nto be an integer power of 2, though in such a case evaluation is faster. MagicPlot uses jfftpacklibrary (a Java version of fftpack).

    40

    http://en.wikipedia.org/wiki/Finite_differencehttp://en.wikipedia.org/wiki/Finite_differencehttp://magicplot.com/wiki/integrationhttp://en.wikipedia.org/wiki/FFThttp://en.wikipedia.org/wiki/FFThttp://en.wikipedia.org/wiki/FFThttp://www.netlib.org/fftpackhttp://en.wikipedia.org/wiki/Finite_differencehttp://magicplot.com/wiki/integrationhttp://en.wikipedia.org/wiki/FFThttp://www.netlib.org/fftpack
  • 7/28/2019 Magic Plot

    41/94

    FFT of table columns dialog

    FFT of curves dialog

    Formulas

    Discrete Fourier Transform Formulas

    By default MagicPlot uses 'electrical engineering' convention to set the sign of the exponentialphase factor of FFT: forward transform is computed using factor -1. Most scientificapplications use factor -1 in forward transform as MagicPlot does by default. But note that thesign of exponential phase factor in Numerical Receipts in C, 2nd edition, p. 503 and inMATLAB package in forward transform is +1.

    Factor 1 (Default)

    1/N in forwardtransform

    Forward Transform(Signal Spectrum)

    Inverse Transform(Spectrum Signal)

    Checked(Default)

    Unchecked

    41

  • 7/28/2019 Magic Plot

    42/94

    Factor +1 (Scientific)

    1/N in forwardtransform

    Forward Transform(Signal Spectrum)

    Inverse Transform(Spectrum Signal)

    Checked(Default)

    Unchecked

    Here cn

    are complex signal components and Cn

    are complex spectrum components, n = 1N.

    The only difference is in the sign of exponential phase factor and 1/Nmultiplier.

    Note: if you expect to get the original data when doing an inverse FFT of forward FFT, set the1/N in Forward Transform, Center Zero Frequency and Factor options the same forforward and inverse transforms.

    Amplitude and Phase Columns Formulas

    Because of using atan2function the phase is unwrapped and is in range (, ]. The result ofatan2(y, x) is similar to calculating the arc tangent ofy/x, except that the signs of botharguments are used to determine the quadrant of the result.

    Sampling Column Formulas

    Sampling column contains frequency samples if forward transform is performed and timesamples in case of inverse transform.

    Center zerofrequency

    Formula Sampling Column Values

    Unchecked

    Checked

    Here tis given sampling interval of initial data (time for FFT and frequency for IFFT), n = 1N.

    Missing Values in the Original Data

    Fourier transform implies that the original samples are uniformly distributed in time (forforward transform) or frequency (for inverse transform).

    Missing values in the middle or in beginning of original data columns are treated as zeros,the result of Fourier transform may be incorrect.

    Missing values in the end of the column are ignored.

    42

    http://en.wikipedia.org/wiki/atan2http://en.wikipedia.org/wiki/atan2http://en.wikipedia.org/wiki/atan2
  • 7/28/2019 Magic Plot

    43/94

    Parameters

    Sampling Interval Sampling interval of original data tis used to compute the data inresulting sampling column. IfGet from box is set, MagicPlot willcalculate sampling interval as a difference between two first values fromgiven column. You can set sampling interval manually by checking Set

    manually box.Note that using of discrete Fourier transform implies that the samples inyour original data are equally spaced in time/frequency, i.e. the samplinginterval is constant. If the sampling interval is varying or real and/orimaginary data contains empty cells in the middle, the result of discreteFourier transform will be incorrect.

    Real,Imaginary

    Columns with real and imaginary components of data.If your data is purely real, select imaginary item

    Forward /Inverse

    Transform direction (here Inverse equals to Backward)

    1/N in forwardtransform

    Also referred as 'Normalize' in some applications. Divide forwardtransform result by number of points N(see formulas table). If youroriginal data is real, you may want to additionally multiply the result by 2to get the true amplitudes of real signal

    Center zerofrequency

    If selected, after forward Fourier transform the two parts of spectrumwill be rearranged so that the lower frequency components are in thecenter; the opposite rearrangement of spectrum will be done beforeinverse transform if any.

    Histogram Calculation (Pro edition only)

    Open Table or Figure or Fit Plot with initial data and selectProcessing Histogram menuitem to calculate histogram.

    Histogram creation dialog

    43

  • 7/28/2019 Magic Plot

    44/94

    Binning Options

    You can either set the bin size/count manually or specify auto binning criteria.

    Bin Bounds

    MagicPlot align the the lower limit of the first bin exactly at the beginning of specifiedhistogram range (From field). The upper limit of the last bin is calculated on the basis of thespecified bin size and may be greater than the specified right histogram limit (to field) asshown on the screenshot above. Enter round value in the From field if you want the lowerlimit of the first bin to be round.

    Auto Binning Criteria

    You can enter custom criteria in ''Auto Binning'' combo box:

    Typing k=... means setting the number of bins k

    Typing h=... means setting the bin size h.

    You can use these parameters in the expression:

    n the number of data points

    s data standard deviation

    m data mean

    min data minimum

    max data maximum.

    The default alternatives are:

    Default criteria in Excel, Origin and some other software

    Scott's formula

    Sturges' formula

    MISE optimisation Shimazaki method. MagicPlot finds the minimum of Mean

    Integrated Squared Error (MISE) for the number of bins from 2 to min(n/2, 20n1/2)where n is the number of data points. See this paper and site for details: Shimazaki andShinomoto, Neural Comput 19 1503-1527, 2007,http://2000.jukuin.keio.ac.jp/shimazaki/res/histogram.html.

    'Keep on Recalculation' Option

    This option is used when the histogram is recalculated. Recalculation may be cause by inputdata change (if Auto Recalculate checkbox is selected) or invoked manually(Recalculate menu item in histogram table column context menu).

    44

    http://2000.jukuin.keio.ac.jp/shimazaki/res/histogram.htmlhttp://2000.jukuin.keio.ac.jp/shimazaki/res/histogram.htmlhttp://2000.jukuin.keio.ac.jp/shimazaki/res/histogram.html
  • 7/28/2019 Magic Plot

    45/94

    Preview Plot

    The preview plot shows the histogram which is evaluated according to selected parameters. Italso shows the data point positions on X axis in the bottom of the plot.

    Descriptive Statistics (Pro edition only)SelectTools Statistics menu item to open the statistics dialog. Statistics dialog showsstatistics on currently selected table columns or curves on plot. The statistics is updated everytime you activate different windows or change the selection in active window. Select multipleinstances in one window (columns or curves) to view multiple statistics data.

    Statistics dialog

    Showed Statistical Properties

    By default some statistical properties are not shown. Click Show button to select which

    properties you want to calculate.

    Statistical Functions in Column Formulas

    You can also calculate statistics on table columns using column statistics functions whenentering column formula. See Functions tab in Set Column Formula dialog for columnstatistics functions description. These functions are also available in MagicPlot Studentedition.

    Computational Formulas

    Central moments are calculated as follows (see table). All sums are calculated usingcompensated summation. Central moments are calculated on second pass after Meancalculation.

    45

    http://en.wikipedia.org/wiki/Compensated_summationhttp://en.wikipedia.org/wiki/Compensated_summationhttp://en.wikipedia.org/wiki/Compensated_summation
  • 7/28/2019 Magic Plot

    46/94

    Property Formula

    n The number of non-empty cells

    Mean

    Central moments

    MagicPlot uses the following formulas to calculate statistics:

    Property Formula

    Mean (expected value)

    Variance

    Standard deviation

    Skewness

    Kurtosis

    Y Sum

    Calculating Integrals and Statistics (Pro) on Intervals using

    Fit PlotSetting of intervals in Fit interval tab of Fit Plot was initially intended for specifying therange of data which are used for fitting by sum of fit curves. However, this tab can also be usedto calculate integrals and statistics on these intervals (Statistics is only available in Proedition). Data-Baseline is used to calculate the results.

    MagicPlot can integrate data on selected intervals and calculate peak moments (x mean,variance, skewness, kurtosis). Spectrum line is treated as probability distribution curve: xvalues are treated as 'independent variable' andyvalues are treated as 'probability'. Standardstatistical formulas are used to calculate moments (see below).

    Statistical data and integrals are automatically updated ifxorydata are changed or intervalsare changed.

    46

    http://en.wikipedia.org/wiki/Central%20momenthttp://en.wikipedia.org/wiki/Central%20momenthttp://en.wikipedia.org/wiki/Central%20moment
  • 7/28/2019 Magic Plot

    47/94

    Integration on intervals

    All statistical data are summarized in the intervals table:

    Statistics on intervals

    Managing IntervalsMove interval borders with mouse. Double click on interval to split it at desired position. Rightclick opens context menu from which new intervals can be created on free space and existingintervals can be deleted or split.

    Relative Integrals Calculation

    MagicPlot can calculate relative integrals to compare the relative intensity of spectrum lines.To compute relative integrals set Relative integrals checkbox. MagicPlot designate thesmallest integral as 1, but you can enter a custom value. If you want to set not the smallest

    integral as a reference point, enter 1 first and then enter the value of desired integral relativeto 1 into this field, so that other integrals will be calculated relative to this new value.

    Computational Formulas

    Central moments are calculated as follows (see table). All sums are calculated usingcompensated summation. Central moments are calculated on second pass after Meancalculation.

    47

    http://en.wikipedia.org/wiki/Compensated_summationhttp://en.wikipedia.org/wiki/Compensated_summationhttp://en.wikipedia.org/wiki/Compensated_summation
  • 7/28/2019 Magic Plot

    48/94

    Property Formula

    n The number of non-NaN (x,y) points

    X Mean

    Central moments

    MagicPlot uses the following formulas to calculate intervals statistics:

    Property Formula

    Integral Calculated using Trapezoidal rule

    X Mean (expected value)

    Variance

    Standard deviation

    Skewness

    Kurtosis

    Y Sum

    See Also

    Nonlinear Curve Fitting: Fit Plot

    Using Spline for Baseline Subtraction (Pro edition only)

    Descriptive Statistics (Pro edition only)

    Transform X or Y Fit Plot Data (Pro edition only)You can quickly transform X or Y data on Fit Plot by using Transform Plot Data items inProcessing menu. These menu items open set column formula dialog for table column whichis used as X or Y. Note that this transformation affects the table with plotted data.

    See Also

    Nonlinear Curve Fitting: Fit Plot

    Formula Syntax

    Formula editor is used in the following cases:

    Setting Column Formula

    Custom Fit Curve

    48

    http://en.wikipedia.org/wiki/Central%20momenthttp://en.wikipedia.org/wiki/Central%20momenthttp://magicplot.com/wiki/integrationhttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/statisticshttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/set_column_formulahttp://magicplot.com/wiki/fittinghttp://en.wikipedia.org/wiki/Central%20momenthttp://magicplot.com/wiki/integrationhttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/splinehttp://magicplot.com/wiki/statisticshttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/set_column_formulahttp://magicplot.com/wiki/fitting
  • 7/28/2019 Magic Plot

    49/94

    Entering value in any numeric field and in tables

    MagicPlot Calculator

    MagicPlot uses standard IEEE 754 double precision floating-point arithmetic. Doubleprecision floating point takes 8 bytes per number and provides a relative precision of about

    16 decimal digits and magnitude range from about 10-308 to about 10+308.

    Syntax Highlighting

    MagicPlot formula editor highlights expression syntax. It also marks matching brackets:

    General Rules

    Case Sensitivity

    MagicPlot formula translator is generally case sensitive, i.e. you can write sin but notSin.Note that x and X are different variables. You can use this feature when naming CustomEquation Fit Curve parameters.

    Entering Numbers

    You can use dot (.) or comma (,) as decimal separator, and separate function argumentswith a semicolon (;) in the following cases:

    Cell editing inTables

    Entering value in any numeric field Using MagicPlot Calculator

    You can use dot (.) only as decimal separator, and separate function arguments with acomma (,) or a semicolon (;), in:

    Setting Column Formula

    Custom Fit Curve

    You can use e or E for scientific notation: 1.45e-3 or 1.45E-3.

    Using Spaces and Line Breaks

    You can freely insert space characters and line breaks in formula, but do not break functionnames, numbers, operators. You do not need to enter special characters to indicate line break.

    Functions

    You can see a list of all available functions and their descriptions in Functions tab in SetColumn Formula window and in Help on Functions window which can be opened frommenu in calculator window.

    MagicPlot uses functions of Java programming language library StrictMath to evaluate sin,cos, exp, etc. These functions are available from the well-known network library netlib as a

    49

    http://magicplot.com/wiki/calculatorhttp://en.wikipedia.org/wiki/IEEE754http://en.wikipedia.org/wiki/Double_precision_floating-point_formathttp://magicplot.com/wiki/tablehttp://magicplot.com/wiki/tablehttp://magicplot.com/wiki/calculatorhttp://magicplot.com/wiki/set_column_formulahttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/calculatorhttp://download.oracle.com/javase/6/docs/api/java/lang/StrictMath.htmlhttp://magicplot.com/wiki/calculatorhttp://en.wikipedia.org/wiki/IEEE754http://en.wikipedia.org/wiki/Double_precision_floating-point_formathttp://magicplot.com/wiki/tablehttp://magicplot.com/wiki/calculatorhttp://magicplot.com/wiki/set_column_formulahttp://magicplot.com/wiki/fittinghttp://magicplot.com/wiki/calculatorhttp://download.oracle.com/javase/6/docs/api/java/lang/StrictMath.html
  • 7/28/2019 Magic Plot

    50/94

    Freely Distributable Math Library, fdlibm package. The same library is widely used in manyscientific computing applications.

    Trigonometric Functions

    MagicPlot supports all standard trigonometric functions (sin, cos, etc.). All angles are always

    measured in radians for clarity.You can use the following functions to convert angles units:

    deg(a) converts angles input in radians to an equivalent measure in degrees.

    rad(a) converts angles input in degrees to an equival