I have a signal, s, given at the end of this message. I need to remove the square wave shape from it. The desired signal is actually very small and it has been contaminated by a strong square-shape noise.
The desired signal is just couple peaks similar to an ECG or EEG but we have a very large square-shape noise that randomly affects some of the scan results.
Central Freq = 10MHz, Sampling Freq = 125MHz
(Please note that these are the frequencies related to the red signal and robot's transducer that transmits the ultrasonic pulse. These are not the frequencies of the blue signal nor that of the square-wise wave.)
s = [0.00463923811912537,0.00524966418743134,-0.000122085213661194,-0.00683677196502686,-0.00671468675136566,0.00183127820491791,0.00610426068305969,0.00256378948688507,-0.00500549376010895,-0.00647051632404327,-0.000610426068305969,0.00549383461475372,0.00476132333278656,-0.00329630076885223,-0.00805762410163879,-0.00256378948688507,0.00622634589672089,0.00915639102458954,0.00354047119617462,-0.00366255640983582,-0.00305213034152985,0.00488340854644775,0.00866805016994476,0.00476132333278656,-0.00439506769180298,-0.00720302760601044,-0.000732511281967163,0.00598217546939850,0.00402881205081940,-0.00390672683715820,-0.00915639102458954,-0.00317421555519104,0.00402881205081940,0.00598217546939850,0.000976681709289551,-0.00598217546939850,-0.00366255640983582,0.00561591982841492,0.0101330727338791,0.00720302760601044,-0.000732511281967163,-0.00183127820491791,0.00378464162349701,0.0102551579475403,0.00598217546939850,-0.00366255640983582,-0.00891222059726715,-0.00341838598251343,0.00134293735027313,0.00207544863224030,-0.00476132333278656,-0.0123306065797806,-0.00830179452896118,0.00427298247814179,0.0134293735027313,0.0155048221349716,0.0133072882890701,0.0153827369213104,0.0225857645273209,0.0220974236726761,0.00866805016994476,-0.0102551579475403,-0.0233182758092880,-0.0201440602540970,-0.0126968622207642,-0.00512757897377014,-0.00537174940109253,-0.00866805016994476,-0.00415089726448059,0.00366255640983582,0.00341838598251343,-0.00427298247814179,-0.0119643509387970,-0.0106214135885239,0.00109876692295074,0.0111097544431686,0.0129410326480865,0.00683677196502686,0.00280795991420746,0.00964473187923431,0.0168477594852448,0.0153827369213104,0.00586009025573731,-0.00427298247814179,-0.00586009025573731,-0.00341838598251343,-0.00573800504207611,-0.0152606517076492,-0.0238066166639328,-0.0242949575185776,-0.0181906968355179,-0.0152606517076492,-0.0229520201683044,-0.0310096442699432,-0.0290562808513641,-0.0115980952978134,0.00586009025573731,0.0212428271770477,0.0324746668338776,0.0376022458076477,0.0427298247814179,0.0583567321300507,0.0894884616136551,0.113783419132233,0.121230617165565,0.114271759986877,0.126236110925674,0.157612010836601,0.171529725193977,0.160542055964470,0.126968622207642,0.0648272484540939,0.00512757897377014,-0.0288121104240417,-0.0553046017885208,-0.0919301658868790,-0.142473444342613,-0.180197775363922,-0.187767058610916,-0.192040041089058,-0.219509214162827,-0.240019530057907,-0.246612131595612,-0.231717735528946,-0.172506406903267,-0.0767915993928909,0.0205103158950806,0.108289584517479,0.209742397069931,0.248199239373207,0.242339149117470,0.246490046381950,0.257843971252441,0.264314502477646,0.266267865896225,0.256012707948685,0.210719078779221,-0.00427298247814179,-0.169332191348076,-0.236234888434410,-0.236845314502716,-0.247100472450256,-0.255280196666718,-0.257111459970474,-0.253326833248138,-0.252228051424027,-0.256012707948685,-0.258820652961731,-0.259186923503876,-0.256989389657974,-0.231107309460640,0.0240507870912552,0.172506406903267,0.246245875954628,0.253326833248138,0.258088141679764,0.253937244415283,0.243071660399437,0.241240382194519,0.260285675525665,0.278110116720200,0.272372126579285,0.240141615271568,-0.0282016843557358,-0.180441945791245,-0.240996211767197,-0.235746547579765,-0.243315830826759,-0.257721900939941,-0.269197911024094,-0.268831640481949,-0.267732888460159,-0.269442081451416,-0.269808322191238,-0.262849479913712,-0.109632521867752,0.136491268873215,0.231595650315285,0.253326833248138,0.252472221851349,0.259919434785843,0.264802843332291,0.264192402362824,0.261018186807632,0.257966071367264,0.260041505098343,0.264802843332291,0.262727379798889,0.160908311605454,-0.106458306312561,-0.217189595103264,-0.247466728091240,-0.237821996212006,-0.250396788120270,-0.271151274442673,-0.278598457574844,-0.276034682989121,-0.266756206750870,-0.261750698089600,-0.255280196666718,-0.244414597749710,0.0291783660650253,0.194481745362282,0.263459891080856,0.253448903560638,0.246490046381950,0.247100472450256,0.258820652961731,0.270785003900528,0.278354287147522,0.271883785724640,0.259675264358521,0.220241725444794,-0.0590892434120178,-0.198022216558456,-0.266756206750870,-0.273470878601074,-0.274081319570541,-0.268343299627304,-0.269075810909271,-0.275058001279831,-0.275912582874298,-0.265413254499435,-0.250640958547592,-0.241484552621841,-0.000122085213661194,0.173849344253540,0.258332312107086,0.271151274442673,0.273470878601074,0.270907104015350,0.262116968631744,0.254181414842606,0.253082662820816,0.255036026239395,0.255036026239395,0.250640958547592,0.234281525015831,-0.0394335240125656,-0.193260893225670,-0.267854958772659,-0.273715049028397,-0.276767194271088,-0.271639615297318,-0.259431093931198,-0.246123790740967,-0.240874126553535,-0.243682086467743,-0.244292512536049,-0.234525695443153,-0.0302771329879761,0.171529725193977,0.256012707948685,0.267488718032837,0.267854958772659,0.271761685609818,0.272738367319107,0.264314502477646,0.251251369714737,0.244170427322388,0.244414597749710,0.239653274416924,-0.0218532532453537,-0.188255399465561,-0.269075810909271,-0.266512036323547,-0.262849479913712,-0.263948231935501,-0.264192402362824,-0.258576482534409,-0.246612131595612,-0.236723229289055,-0.231717735528946,-0.231473565101624,-0.106824561953545,0.137223780155182,0.243560001254082,0.272738367319107,0.263826161623001,0.251373469829559,0.241606637835503,0.238310337066650,0.241118296980858,0.241484552621841,0.241728723049164,0.242094978690147,0.214747890830040,-0.0557929426431656,-0.196190938353539,-0.266023695468903,-0.271151274442673,-0.269197911024094,-0.263337820768356,-0.255402266979218,-0.249420091509819,-0.245513364672661,-0.244048342108727,-0.239897444844246,-0.234647780656815,0.0107434988021851,0.176535218954086,0.252350151538849,0.252960562705994,0.254425585269928,0.254791855812073,0.249542176723480,0.244170427322388,0.244170427322388,0.245025023818016,0.244902938604355,0.242094978690147,0.204370647668839,-0.0599438399076462,-0.192406296730042,-0.246245875954628,-0.245391279459000,-0.248077154159546,-0.248565495014191,-0.241118296980858,-0.231717735528946];