1 | /* Class ImpedSpecRegressionFunction2
|
---|
2 | *
|
---|
3 | * This class acts as a container for the user supplied regression function,
|
---|
4 | * via the interface ImpedSpecModel, for the class ImpedSpecRegression
|
---|
5 | * which contains the non-linear regression procedures for fitting impedance
|
---|
6 | * spectroscopy and electrochemical impedance spectroscopy
|
---|
7 | * data to a circuit model.
|
---|
8 | *
|
---|
9 | * This class implements RegressionFunction2
|
---|
10 | * The user supplied circuit model requires the interface ImpedSpecModel
|
---|
11 | *
|
---|
12 | * WRITTEN BY: Dr Michael Thomas Flanagan
|
---|
13 | *
|
---|
14 | * DATE: May 2007
|
---|
15 | *
|
---|
16 | * DOCUMENTATION:
|
---|
17 | * See Michael T Flanagan's Java library on-line web pages:
|
---|
18 | * http://www.ee.ucl.ac.uk/~mflanaga/java/
|
---|
19 | * http://www.ee.ucl.ac.uk/~mflanaga/java/ImpedSpecSimulation.html
|
---|
20 | *
|
---|
21 | * Copyright (c) May 2007 Michael Thomas Flanagan
|
---|
22 | *
|
---|
23 | * PERMISSION TO COPY:
|
---|
24 | * Permission to use, copy and modify this software and its documentation for
|
---|
25 | * NON-COMMERCIAL purposes is granted, without fee, provided that an acknowledgement
|
---|
26 | * to the author, Michael Thomas Flanagan at www.ee.ucl.ac.uk/~mflanaga, appears in all copies.
|
---|
27 | *
|
---|
28 | * Dr Michael Thomas Flanagan makes no representations about the suitability
|
---|
29 | * or fitness of the software for any or for a particular purpose.
|
---|
30 | * Michael Thomas Flanagan shall not be liable for any damages suffered
|
---|
31 | * as a result of using, modifying or distributing this software or its derivatives.
|
---|
32 | *
|
---|
33 | ****************************************************************************************/
|
---|
34 |
|
---|
35 | package agents.anac.y2015.agentBuyogV2.flanagan.circuits;
|
---|
36 |
|
---|
37 | import agents.anac.y2015.agentBuyogV2.flanagan.analysis.RegressionFunction2;
|
---|
38 | import agents.anac.y2015.agentBuyogV2.flanagan.complex.Complex;
|
---|
39 | import agents.anac.y2015.agentBuyogV2.flanagan.io.*;
|
---|
40 |
|
---|
41 | public class ImpedSpecRegressionFunction2 implements RegressionFunction2{
|
---|
42 |
|
---|
43 | public int numberOfFrequencies = 0; // number of frequencies
|
---|
44 | protected ImpedSpecModel isModel = null; // ImpedSpecModel containing the regression function
|
---|
45 |
|
---|
46 | public double function(double[] parameters, double[] omega, int pointN){
|
---|
47 |
|
---|
48 | Complex zVal = isModel.modelImpedance(parameters, omega[0]); // call impedance calculation method
|
---|
49 |
|
---|
50 | if(pointN<this.numberOfFrequencies){
|
---|
51 | return zVal.getReal();
|
---|
52 | }
|
---|
53 | else{
|
---|
54 | return zVal.getImag();
|
---|
55 | }
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 |
|
---|