📄 padecurvefitting.java
字号:
/**
* Description: Pade fitting function
*
* @ Author Create/Modi Note
* Xiaofeng Xie Jun 26, 2008
*
* @version 1.0
* @Since MAOS1.0
*
*/
package problem.custom;
public class PadeCurveFitting extends AbstractCurveFitting {
private static int NG = 2;
private double minY = -100;
private double maxY = 100;
private double[] xx = new double[NG];
public PadeCurveFitting() throws Exception {
super(NG);
}
public void initEncoder() throws Exception {
if (NG!=2) {
initParams(NG*2+1);
xx = new double[NG];
}
super.initEncoder();
setDefaultXRanges();
}
private void setDefaultXRanges() {
for(int i=0; i<NG*2+1; i++) {
setDefaultXAt(i, minY, maxY);
}
}
public boolean setParameter(String name, String value) {
if (super.setParameter(name, value)) return true;
else if (name.equalsIgnoreCase("NG")) NG=new Integer(value).intValue();
else if (name.equalsIgnoreCase("minY")) minY=new Integer(value).intValue();
else if (name.equalsIgnoreCase("maxY")) maxY=new Integer(value).intValue();
else return false;
return true;
}
protected double getFuncValue(double x, double[] VX) {
xx[0] = x;
for (int i=1; i<xx.length; i++) {
xx[i] = xx[0]*xx[i-1];
}
double realV1 = VX[0];
for (int i=0; i<xx.length; i++) {
realV1+= VX[i+1]*xx[i];
}
double realV2 = 1;
for (int i=0; i<xx.length; i++) {
realV2+= VX[xx.length+i+1]*xx[i];
}
return realV1/realV2;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -