Created
February 5, 2017 02:54
-
-
Save kenkangxgwe/1950294181066c1fc9d2753f3db68930 to your computer and use it in GitHub Desktop.
Using Least Square Method for a X-Y 2D array.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* ::Package:: *) | |
Targetdir1 = "%Yourdir%\\*.txt" | |
(*For the table having two demensions.*) | |
Data=Import[Targetdir1,"Table"]; | |
Model = LinearModelFit[Data, x, x] | |
Show[ListPlot[Data, AxesOrigin -> {0, 0}, AxesLabel -> {"x", "y"}], | |
Plot[Normal[Model], {x, First[First[Data]], First[Last[Data]]}]] | |
Model["ParameterTable"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment