void Correlation::output()
{
    // calculate the FFTs of the two functions
	if( gsl_fft_real_radix2_transform( d_x, 1, d_n ) == 0 &&
        gsl_fft_real_radix2_transform( d_y, 1, d_n ) == 0)
	{
		for(int i=0; i<d_n/2; i++ ){// multiply the FFT by its complex conjugate
			if( i==0 || i==(d_n/2)-1 )
				d_x[i] *= d_x[i];
			else{
				int ni = d_n-i;
				double dReal = d_x[i] * d_y[i] + d_x[ni] * d_y[ni];
				double dImag = d_x[i] * d_y[ni] - d_x[ni] * d_y[i];
				d_x[i] = dReal;
				d_x[ni] = dImag;
			}
		}
	} else {
		QMessageBox::warning((ApplicationWindow *)parent(), tr("QtiPlot") + " - " + tr("Error"),
                             tr("Error in GSL forward FFT operation!"));
		return;
	}

	gsl_fft_halfcomplex_radix2_inverse(d_x, 1, d_n );	//inverse FFT

	addResultCurve();
    d_result_table = d_table;
}
double Integration::trapez()
{
	double sum = 0.0;
	double *result = (double *)malloc(d_n*sizeof(double));
	int size = d_n - 1;
	for(int i=0; i < size; i++){
		int j = i + 1;
		if (result)
            result[i] = sum;
		sum += 0.5*(d_y[j] + d_y[i])*(d_x[j] - d_x[i]);
	}

    if (result){
        result[size] = sum;
        d_points = d_n;
        d_output_graph = NULL;
        addResultCurve(d_x, result);
        free(result);
    }
    return sum;
}
Esempio n. 3
0
void Filter::output()
{
    double X[d_points], Y[d_points];
    calculateOutputData(X, Y); //does the data analysis
	addResultCurve(X, Y);
}
Esempio n. 4
0
void Deconvolution::output()
{
	convlv(d_x, signalDataSize(), d_y, responseDataSize(), -1);
	addResultCurve();
    d_result_table = d_table;
}
Esempio n. 5
0
void Convolution::output()
{
	convlv(d_x, d_n_signal, d_y, d_n_response, 1);
	addResultCurve();
    d_result_table = d_table;
}
Esempio n. 6
0
void Filter::output()
{
    QVarLengthArray<double> X(d_points), Y(d_points);
    calculateOutputData(X.data(), Y.data()); //does the data analysis
	addResultCurve(X.data(), Y.data());
}