commit : sureshrink error correction

This commit is contained in:
Rafat Hussain 2017-08-09 04:50:41 +05:30
parent fa68a811af
commit ee88fece29
3 changed files with 8 additions and 5 deletions

View File

@ -248,17 +248,17 @@ void sureshrink(double *signal,int N,char *wname,char *method,char *ext,char *th
if(!strcmp(thresh,"hard")) {
for(i = 0; i < dwt_len;++i) {
if (fabs(wt->output[len+i]) < td) {
wt->output[i] = 0;
wt->output[len+i] = 0;
}
}
} else if(!strcmp(thresh,"soft")) {
for(i = 0; i < dwt_len;++i) {
if (fabs(wt->output[len + i]) < td) {
wt->output[i] = 0;
wt->output[len+i] = 0;
} else {
sgn = wt->output[len+i] >= 0 ? 1 : -1;
temp = sgn * (fabs(wt->output[len+i]) - td);
wt->output[i] = temp;
wt->output[len+i] = temp;
}
}
}

View File

@ -13,6 +13,8 @@ extern "C" {
void visushrink(double *signal,int N,char *wname,char *method,char *ext,char *thresh,double *denoised);
void sureshrink(double *signal,int N,char *wname,char *method,char *ext,char *thresh,double *denoised);
double mad(double *x, int N);

View File

@ -39,9 +39,10 @@ int main() {
inp[i] = temp[i];
}
visushrink(inp,N,wname,method,ext,thresh,oup);
//visushrink(inp,N,wname,method,ext,thresh,oup);
sureshrink(inp,N,wname,method,ext,thresh,oup);
ofp = fopen("denoised.txt", "w");
ofp = fopen("denoiseds.txt", "w");
for(i = 0; i < N;++i) {
fprintf(ofp,"%g \n",oup[i]);