int main() {
	std::vector<Vector<value_type> > x(3,Vector<value_type>(1,0.0)), y(3,Vector<value_type>(1,0.0));
	
	std::cout << "here-1\n";
	x[0] = {-2}; y[0] = {0};
	x[1] = {-1}; y[1] = {-1};
	x[2] = {1}; y[2] = {0}; 
	std::cout << "here0\n";
	Vector<value_type> a(3);
	for(unsigned i=0;i<a.size();++i)
		a[i] = i;
	std::cout << "here1\n";
	ParameterPolynome<value_type> pp(a);
	std::cout << "here2\n";
	LM_Solver<value_type> lms(pp,x,y);
	std::cout << "here3\n";
	lms.solve();
	std::cout << "here4\n";
	
	std::cout << "polynom durch: \n";
	for(unsigned i=0;i<x.size();++i)
		std::cout << "(" << x[i] << "," << y[i] << ") ";
	std::cout << "\ngegeben durch:\n";
	
	std::cout << pp.A() << " ";
	std::cout << "\n";
	
	std::cout << "x1:" << x[0] << " f:=" << pp.fx(x[0]) << "\n";
	std::cout << "x2:" << x[1] << " f:=" << pp.fx(x[1]) << "\n";
	std::cout << "x3:" << x[2] << " f:=" << pp.fx(x[2]) << "\n";

	return 0;
}
Beispiel #2
0
int benchmark()
{
    float lms(float,float,float *,int,float,float);
    static float d[N],b[21];
    float signal_amp,noise_amp,arg,x/*,y*/; /* JG */
    int k;

    /* create signal plus noise */
    signal_amp = lms_sqrt(2.0);
    noise_amp = 0.2*lms_sqrt(12.0);
    arg = 2.0*PI/20.0;
    for(k = 0 ; k < N ; k++) {
        d[k] = signal_amp*lms_sin(arg*k) + noise_amp*gaussian();
    }

    /* scale based on L */
    mu = 2.0*mu/(L+1);

    x = 0.0;
    for(k = 0 ; k < N ; k++) {
        lms(x,d[k],b,L,mu,0.01);
    /* delay x one sample */
        x = d[k];
    }
    return 0;
}