cout << endl << "If you would like to combine input sequence A and B enter 'y', otherwise enter 'n'" << endl;
char prompt6;
cin >> prompt6;
if(prompt6 == 'y'){
int e = full.get_num_samples();
int d = fullsecond.get_num_samples();
int i;
sequence combine(e,d);
for(i=0; i<e; i++){
combine.value[i] = full.value[i];
cout << "Combined sequence value no. " << (i+1) << ": " << combine.value[i] << endl;
}
int z;
for(z=0; z<d; z++){
combine.value[z] = fullsecond.value[z];
cout << "Combined sequence value no. " << (z+e+1) << ": " << combine.value[z] << endl;
}
cout << endl << "Would you like to calculate the the filtered response of the combined sequence enter 'y'" << endl;
char prompt6;
cin >> prompt6;
if(prompt6 == 'y') {
int v;
v = combine.get_num_samples();
FIR response(v); // created the combined a and b sequence and allocated the memory fo array.
int x;
int t;
float temp[v];
for(x=0; x<v; x++){
temp[0] = combine.value[0];
temp[x] = combine.value[x] + temp[x-1];
response.value[x] = temp[0] + temp[x];
cout << "Response value no. " << (x+1) << ": " << response.value[x] << endl;
}
}
}
}
return 0;
}
I cannot get my FIR filter to work.
It should have
voutput 1 = vinput 1
voutput 2 = vinput 1 + 2
voutput 3 = vinput 1 + 2 + 3
vinput here is the combine object in sequence class.