|
[Date Index]
[Thread Index]
[Author Index]
Re: Anti-Chop Function
- To: mathgroup at smc.vnet.net
- Subject: [mg5828] Re: [mg5813] Anti-Chop Function
- From: Edward Neuman <edneuman at math.siu.edu>
- Date: Thu, 23 Jan 1997 03:19:31 -0500
- Sender: owner-wri-mathgroup at wolfram.com
At 12:44 AM 1/22/97 -0500, you wrote:
>The Chop[Data, Min] sets all values in Data that are < Min equal to 0. Is
>there an equivalent function that will take all values in Data that are >
>Max and set them equal to 0? I'm trying to eliminate the DC components
>of a Fourier transform, and the only way I've been able to do it to date
>is buy manually Delete[]-ing the first value and Insert[] -ing 0.
>
>
>Mat
>---
>Mathew Jason Binkley - Astronomy TA | "It was the dawn of the Third Age
>Wake Forest University - Olin 304 | of mankind, the year the Great
>Phone: (910) 759-4957 | War came upon us all."
>WWW: http://www.wfu.edu/~binklmj5/ | - John Sheridan, Babylon 5
>
>
>
Mathew;
The "Anti-Chop Function," named here f, uses a pattern matching
transformation rule:
In[1]:=
Clear[f]
In[2]:=
f[mylist_,mymax_]:=mylist//.{a___,b_,c___}/;Abs[b]>=mymax:>{a,0,c}
In[3]:=
mymax=1.0;
mylist={-1.5,-0.5,0.5,3.0};
In[4]:=
f[mylist,mymax]
Out[4]=
{0,-0.5,0.5,0}
I hope this does a job.
Edward
===========================================================
Edward Neuman Phone: (618) 453-6501
Department of Mathematics Fax: (618) 453-5300
Southern Illinois University E-mail:edneuman at math.siu.edu
Carbondale, Il. 62901-4408
WWW: http://www.science.siu.edu/mathematics/neuman/
Prev by Date:
extracting elements from a list of lists
Next by Date:
Re: Comparison of Mathematica on Various Computers
Previous by thread:
Anti-Chop Function
Next by thread:
Re: Anti-Chop Function
|