source: src/main/java/agents/anac/y2015/agentBuyogV2/flanagan/circuits/ImpedSpecRegressionFunction2.java

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 2.4 KB
Line 
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
35package agents.anac.y2015.agentBuyogV2.flanagan.circuits;
36
37import agents.anac.y2015.agentBuyogV2.flanagan.analysis.RegressionFunction2;
38import agents.anac.y2015.agentBuyogV2.flanagan.complex.Complex;
39import agents.anac.y2015.agentBuyogV2.flanagan.io.*;
40
41public 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
Note: See TracBrowser for help on using the repository browser.