Origin curve fitting function using a custom function

      Uncle recently materialized theory should be working to pay it, many people ask me Uncle inside job title to prescribe how to fit the image function. Taken together the two main issues:
      1. know the exact fitting equation image, but do not know how fit. (This is the focus of this article)
      2. Do not know exactly fit the image of the equation, I do not know how fit, that I can provide a little direction of a fitting.
      I do not know the exact start start fitting equation image of it, when you get a set of data, you certainly look at what the horizontal and vertical coordinates are written in the second asked 19 questions of which require the enthalpy of vaporization and thermodynamic temperature relations, learned materialized all know, certainly Clausius - Clapeyron equation to appear relationship between these two variables. So here we have to use this equation to our data distortion.
$$ ln frac {p} {p ^ ø} = frac {△ _p H ^ m} {R} (frac {1} {373} -frac {1} {T}) $$
      which is very obvious thing, under the pressure of the vapor pressure divided by the standard state we get, and it's a logarithmic / T linear relationship -1, then I would not say it.
      One idea is to improve the mathematical modeling and correction ah according to the existing empirical formula, because modeling also in line with the Basic Law, ah, not just on the last operator of it.
      18 questions I left behind say, first complete the process of fitting the first 19 questions asked here to write again.
      1. The conventional data form to fit the desired handle, Equation 19 is the question:
$$ P LG A-FRAC = {B} {} $$ the TC
      argument to the thermodynamic temperature T, the dependent variable is log10 (p), first collated, this is very easy to do in Excel inside.

Picture 1

      2. Open the Origin, I was 2015, different versions of the operating similar, open Analysis → Fitting → Nonlinear Curve Fit → Open dialog.
Picture 2

      3. In the Category inside select User Defined, visible Origin fitting functions are also similar to Matlab M-files can still write your own.
Picture 3

      4. Of course, a function is slightly New, New not an object.
Picture 4

      5. From the beginning of this chart, note Hints on the left, than the so-called online tutorials that do not know where to go up. Hints can be seen in, to enter the function name, the suffix is ​​the FDF, then the function model, Explicit means clear, Function Type is an expression, also known as y = f (x) of the form, you can see can choose Equlations, the left Hints tells us that this type of treatment is only one independent variable.
Picture 5

      6. Click Next, this interface is the input argument, the dependent variable, the name of the parameter, a sense of heaven to thank my mathematical statistics is the English version, direct reading here stress-free, you can see, when multiple parameters separated by commas.
Picture 6

      7. This interface is a most critical part of the whole process, from the fitting process defined functions most important thing is the initial selection, here we first put in the form of input functions as required. He noted that the left side of Hints, Fixed bad times is that if the initial value of the selected parameter value can not be changed, obviously does not meet our means, so we do not check here. Fixed range has been determined using certain parameters of the time. Followed by the initial attempt, see the following Quick Check yet, here we are to choose different ABC as the initial value, so that when we enter a T, ran out of the test results come out closer to our data value.
Picture 7

      8. After a long test, I tested out a set of values, as long as you can close, does not require a complete match, and then click Next.
Picture 8

      9. This interface is also very important, is just a test point, and now the big columns   Origin using a custom function curve fitting functions is the need to become a point of a set of values, making our multi-function test values to match as much as possible, we click on the red button in the text box to open the code interface.
Picture 9

      10. See this interface, a deep sense of style hit ...... C ++ code, really long like C ++, but it is mixed with the style of Matlab, Matlab based on the idea, it is easy to think of this is stored Vector Matlab value matrix, as these type double, obviously it is digital, this reminds us, Code to be executed to initialized parameters, the code will be executed after the initialization parameters. We want our expression entered into, so that vector can store as much as possible and close to the value of the test, according to the variable to store the name, it is easy to know what the input is.
Picture 10

      11. Click Compile the upper left, is compiling, it really is a C ++ style code ...... see the compilation is successful, if it fails, double-check is not something to play less, but a comma as the end of each line is also against humanity ......
Picture 11

      12. Then close the code window to see more than a series of such symbols here, and click Next, Next all the way until the Finish.
Picture 12

      13. Finish later return to this screen, then click on the red button in the box, this refers to Fit untiled Converged, that is, according to Chi-Square Test, after satisfying conditions in order to function until convergence, click once on it. You can see the prompt, Fit may be Converged.
Picture 13

      14. Click the Fit, we can see a very nice fit a curve, R-Square or 0.99997 Oh, I believe this should be fit to meet the requirements, the next small partners know how to do it.
Picture 14

      Well began to study 18 questions, 18 questions which turned out to be no formula, but many small partners to get the answer, the answer is there is a very strange way of fitting and the iteration of what, in fact, in essence it is not difficult also using the method just, but here more than a few steps, one of which is put constant input name input parameter name in step 5, for example, here is sigma, then try the initial value when you want to constant sigma value of the input interface is 0.07275, try to start the initial value.
      According to the above steps started custom function obtained by fitting the interface is as follows. Iteration Algorithm Here's how the answer was written, but the Fit did not Converge is what ah, I tried many times will not work, including the answer to the initial value of the initial test as well as their own, then bite the bullet directly Fit and we found that it is possible Fit out, just.
Picture 15

      The first is based on the results of the above-mentioned Fit out, I do not think a lot of this 0.996 moment low yet, but it is not convergence, in other words, there is certainly a form of expression than its better meet the requirements.
Picture 16

      We look back at the equation, you see ln (1 + x), you see this really do not think of using Taylor expansion, with what is not on what issues are resolved yet, and polynomial fit in at Origin there are shortcuts ah!
Picture 17

      The Analysis → Fitting → Polynormal Fit, 2,3,4 readily test the number three, the number of at least three out of R-Square fitting than that from high-defined functions, where 3 is the highest that a, Therefore, we selected three times as long as polynomial fitting value like, ah, of course slightly, capable of expansion by Taylor's premise is remainder tends to 0, so the Taylor expansion can not just indiscriminately.
Picture 18

Guess you like

Origin www.cnblogs.com/wangziqiang123/p/11690616.html