Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
Fix Filtering Frequencies Code in Matlab w/o Built-In Filters
Reply to thread
Message
[QUOTE="roam, post: 5456609, member: 120460"] I want to write a Matlab code which removes all frequency components from a [I].wav[/I] sound file except those within ##±25 Hz## of ##523 Hz## as well as its harmonics (up to the Nyquist frequency). I want to do this [I]without[/I] using any built in filters. Here is my code so far: [CODE][s, Fs] = wavread('chord.wav'); % Reading the .wav sound file sNew = zeros(size(s)); % creating a matrix of zeros the size of s for i = 1:length(sNew) for N=1:1:(Fs/(2*(523+25))); % number of harmonics up to Nyquist freq while abs(s-(523.*N))<25 % while within ±25 range of each of the harmonics sNew(i)=1; % replace the 0 element in sNew with a 1 end end end sFiltered=sNew.*s; % multiplying ones & zeros matrix with s to remove unwanted freqs wavplay(sFiltered,Fs); % playing the resulting filtered sound[/CODE] But this code doesn't work. When I run the code it takes forever and freezes, and there is no output. What is wrong here? Any help with fixing this code is greatly appreciated. [/QUOTE]
Insert quotes…
Post reply
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
Fix Filtering Frequencies Code in Matlab w/o Built-In Filters
Back
Top