本文整理汇总了C++中DataCurve::curveType方法的典型用法代码示例。如果您正苦于以下问题:C++ DataCurve::curveType方法的具体用法?C++ DataCurve::curveType怎么用?C++ DataCurve::curveType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataCurve
的用法示例。
在下文中一共展示了DataCurve::curveType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateFitCurve
void MultiPeakFit::generateFitCurve()
{
ApplicationWindow *app = (ApplicationWindow *)parent();
if (!d_gen_function)
d_points = d_n;
int i, j;
int peaks_aux = d_peaks;
if (d_peaks == 1)
peaks_aux--;
if (d_gen_function){
customizeFitResults();
if (d_graphics_display){
if (!d_output_graph)
createOutputGraph();
if (d_peaks > 1)
insertFitFunctionCurve(QString(objectName()) + tr("Fit"), 2);
else
insertFitFunctionCurve(QString(objectName()) + tr("Fit"));
if (generate_peak_curves){
for (i = 0; i < peaks_aux; i++)//add the peak curves
insertPeakFunctionCurve(i);
}
d_output_graph->replot();
}
} else {
gsl_matrix * m = gsl_matrix_alloc (d_points, d_peaks);
if (!m){
QMessageBox::warning(app, tr("QtiPlot - Fit Error"),
tr("Could not allocate enough memory for the fit curves!"));
return;
}
double *X = (double *)malloc(d_points*sizeof(double));
if (!X){
memoryErrorMessage();
return;
}
double *Y = (double *)malloc(d_points*sizeof(double));
if (!Y){
memoryErrorMessage();
free(X);
return;
}
QString tableName = app->generateUniqueName(tr("Fit"));
QString dataSet;
if (d_curve)
dataSet = d_curve->title().text();
else
dataSet = d_y_col_name;
QString label = d_explanation + " " + tr("fit of") + " " + dataSet;
d_result_table = app->newHiddenTable(tableName, label, d_points, peaks_aux + 2);
QStringList header = QStringList() << "1";
for (i = 0; i<peaks_aux; i++)
header << tr("peak") + QString::number(i+1);
header << "2";
d_result_table->setHeader(header);
QLocale locale = app->locale();
for (i = 0; i<d_points; i++){
X[i] = d_x[i];
d_result_table->setText(i, 0, locale.toString(X[i], 'e', d_prec));
double yi=0;
for (j=0; j<d_peaks; j++){
double diff = X[i] - d_results[3*j + 1];
double w = d_results[3*j + 2];
double y_aux = 0;
if (d_profile == Gauss)
y_aux += sqrt(M_2_PI)*d_results[3*j]/w*exp(-2*diff*diff/(w*w));
else
y_aux += M_2_PI*d_results[3*j]*w/(4*diff*diff+w*w);
yi += y_aux;
y_aux += d_results[d_p - 1];
d_result_table->setText(i, j+1, locale.toString(y_aux, 'e', d_prec));
gsl_matrix_set(m, i, j, y_aux);
}
Y[i] = yi + d_results[d_p - 1];//add offset
if (d_peaks > 1)
d_result_table->setText(i, d_peaks+1, locale.toString(Y[i], 'e', d_prec));
}
customizeFitResults();
if (d_graphics_display){
if (!d_output_graph)
createOutputGraph();
label = tableName + "_2";
DataCurve *c = new DataCurve(d_result_table, tableName + "_1", label);
if (d_curve){
c->setCurveType(d_curve->curveType());
c->setAxis(d_curve->xAxis(), d_curve->yAxis());
//.........这里部分代码省略.........