00001
00005 #include <bpm/bpm_interface.h>
00006 #include <bpm/bpm_rf.h>
00007 #include <bpm/bpm_alloc.h>
00008 #include <bpm/bpm_nr.h>
00009
00021 int rf_butterworthbandpass( double **RF, int order, double f0, double BW ) {
00022
00023
00024 int i = 0;
00025 double f;
00026
00027 if ( ! RF ) {
00028 bpm_error( "Invalid RF pointer in rf_butterworthlowpass(...)",
00029 __FILE__, __LINE__ );
00030 return BPM_FAILURE;
00031 }
00032
00033 if ( f0 <= 0 ) {
00034 bpm_error( "Central frequency <= 0 in rf_butterworthlowpass(...)",
00035 __FILE__, __LINE__);
00036 return BPM_FAILURE;
00037 }
00038
00039 if ( BW <= 0 ) {
00040 bpm_error( "Bandwidth <= 0 in rf_butterworthlowpass(...)",
00041 __FILE__, __LINE__);
00042 return BPM_FAILURE;
00043 }
00044
00045 if ( order <= 0 ) {
00046 bpm_error( "Order of filter =< 0 in rf_butterworthlowpass(...)",
00047 __FILE__, __LINE__);
00048 return BPM_FAILURE;
00049 }
00050
00051 double fc1 = f0 - .5 * BW;
00052 double fc2 = f0 + .5 * BW;
00053
00054 rf_butterworthhighpass( RF, order, fc1 );
00055 rf_butterworthlowpass( RF, order, fc2 );
00056
00057 return BPM_SUCCESS;
00058 }
00059