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