robotsorcerer / Savitzky-Golay

Computes the Savitzky-Golay Filter coefficients.
Apache License 2.0
104 stars 32 forks source link

vector input for savgolfilt() , input vector size 990, wrong output , result compared with python and matlab #5

Closed AmareshPKandagal closed 6 years ago

AmareshPKandagal commented 7 years ago

x: a vector of length 990 I mean x is a vector of [x_1, x_2, ...., x_990]

FILE *fp_y; fp_y=fopen("niosy_data.txt","r"); std::vector x_v(990); if (fp_y == NULL) cout<<"\n\nSpecified file is not found\n\n"<<endl; int i = 0; float Y_data = 0;

while ((fscanf(fp_y, "%f", &Y_data)) != EOF) { x_v.push_back (Y_data); i++; } fclose(fp_y); Eigen::MapEigen::VectorXf x(x_v.data(), 990); auto result_out = savgolfilt(x,3, 11); cout<<result_out::<<endl;

result_out :: 0 0 0 0 0 -nan 0 0 0 0 0

Could you help on same