Dec 30, 2010 #1 D Draculaardi Newbie level 4 Joined Dec 30, 2010 Messages 6 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,320 I am total beginner using Matlab so I need some help creating FIR and IIR filters with Mathlab. I have read audiofile: x=wavread('C:\Pinkpatka.wav',175142); and I should filter it with FIR, which have these factors: [-0.04, 0.1, 0.3, 0.4, 0.3, 0.1, -0.04] I must also filter it with IIR, which have factors b=[0.2939 0.2939], a=[1 -0.4231] I tried google right commands and actually found something. Problem is that no matter how much I tried commands didnt work. (sry for bad English)
I am total beginner using Matlab so I need some help creating FIR and IIR filters with Mathlab. I have read audiofile: x=wavread('C:\Pinkpatka.wav',175142); and I should filter it with FIR, which have these factors: [-0.04, 0.1, 0.3, 0.4, 0.3, 0.1, -0.04] I must also filter it with IIR, which have factors b=[0.2939 0.2939], a=[1 -0.4231] I tried google right commands and actually found something. Problem is that no matter how much I tried commands didnt work. (sry for bad English)
Dec 30, 2010 #2 RBB Full Member level 5 Joined Jul 2, 2007 Messages 303 Helped 71 Reputation 142 Reaction score 36 Trophy points 1,308 Location USA Activity points 2,560 Have you tried the filter function?
Dec 30, 2010 #3 D Draculaardi Newbie level 4 Joined Dec 30, 2010 Messages 6 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,320 RBB said: Have you tried the filter function? Click to expand... Actually I tried it, but seems like it only filtered only 7 first samples and then erased everything after that. Of course it's possible that I made some mistake when I tried it. Like I said I am beginner with Matlab
RBB said: Have you tried the filter function? Click to expand... Actually I tried it, but seems like it only filtered only 7 first samples and then erased everything after that. Of course it's possible that I made some mistake when I tried it. Like I said I am beginner with Matlab
Dec 30, 2010 #4 RBB Full Member level 5 Joined Jul 2, 2007 Messages 303 Helped 71 Reputation 142 Reaction score 36 Trophy points 1,308 Location USA Activity points 2,560 Why don't you paste the section of code, that calls the filter function.
Dec 30, 2010 #5 D Draculaardi Newbie level 4 Joined Dec 30, 2010 Messages 6 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,320 RBB said: Why don't you paste the section of code, that calls the filter function. Click to expand... Because I dont have it anymore. I tried it yesterday and because it totally failed I didnt save it.
RBB said: Why don't you paste the section of code, that calls the filter function. Click to expand... Because I dont have it anymore. I tried it yesterday and because it totally failed I didnt save it.
Dec 30, 2010 #6 RBB Full Member level 5 Joined Jul 2, 2007 Messages 303 Helped 71 Reputation 142 Reaction score 36 Trophy points 1,308 Location USA Activity points 2,560 It should only be a couple lines long... x = wavread('C:\Pinkpatka.wav',175142); B = [-0.04, 0.1, 0.3, 0.4, 0.3, 0.1, -0.04]; y = filter(B, 1, x);
It should only be a couple lines long... x = wavread('C:\Pinkpatka.wav',175142); B = [-0.04, 0.1, 0.3, 0.4, 0.3, 0.1, -0.04]; y = filter(B, 1, x);
Dec 30, 2010 #7 D Draculaardi Newbie level 4 Joined Dec 30, 2010 Messages 6 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,320 RBB said: It should only be a couple lines long... x = wavread('C:\Pinkpatka.wav',175142); B = [-0.04, 0.1, 0.3, 0.4, 0.3, 0.1, -0.04]; y = filter(B, 1, x); Click to expand... Thanks, that really helped. So IIR-filter would go like this? a=[1 -0.4241] b=[0.2929 0.2929] y = filter(b, a, x);
RBB said: It should only be a couple lines long... x = wavread('C:\Pinkpatka.wav',175142); B = [-0.04, 0.1, 0.3, 0.4, 0.3, 0.1, -0.04]; y = filter(B, 1, x); Click to expand... Thanks, that really helped. So IIR-filter would go like this? a=[1 -0.4241] b=[0.2929 0.2929] y = filter(b, a, x);
Dec 30, 2010 #8 RBB Full Member level 5 Joined Jul 2, 2007 Messages 303 Helped 71 Reputation 142 Reaction score 36 Trophy points 1,308 Location USA Activity points 2,560 That's looks right.
Dec 30, 2010 #9 D Draculaardi Newbie level 4 Joined Dec 30, 2010 Messages 6 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,320 Errmm.. It seems like I must also make spectrograms from signals. Command goes like this: S=spectrogram(x,window,noverlap,nfft,fs). So x is signal, window = ?, noverlap=?, nfft=? and fs=44100. I know that these are explained in **broken link removed**, but I don't really understand without good example.
Errmm.. It seems like I must also make spectrograms from signals. Command goes like this: S=spectrogram(x,window,noverlap,nfft,fs). So x is signal, window = ?, noverlap=?, nfft=? and fs=44100. I know that these are explained in **broken link removed**, but I don't really understand without good example.
Dec 30, 2010 #10 Scrts Member level 3 Joined Mar 17, 2009 Messages 60 Helped 15 Reputation 30 Reaction score 15 Trophy points 1,288 Location Kaunas, Lithuania Activity points 1,604 firstly try only spectrogram(x), then check other options if needed.
Dec 31, 2010 #11 D Draculaardi Newbie level 4 Joined Dec 30, 2010 Messages 6 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,320 Scrts said: firstly try only spectrogram(x), then check other options if needed. Click to expand... It's only say: "??? Error using ==> spectrogram at 113 X must be a vector (either row or column)." Edit: Oookey.. Audiofile must be mono not stereo or spectrogram doesn't work. Last edited: Dec 31, 2010
Scrts said: firstly try only spectrogram(x), then check other options if needed. Click to expand... It's only say: "??? Error using ==> spectrogram at 113 X must be a vector (either row or column)." Edit: Oookey.. Audiofile must be mono not stereo or spectrogram doesn't work.
Dec 31, 2010 #12 RBB Full Member level 5 Joined Jul 2, 2007 Messages 303 Helped 71 Reputation 142 Reaction score 36 Trophy points 1,308 Location USA Activity points 2,560 You can access just a single vector in the array via... x(1, x(2, or x,1) x,2) depending on the array size
You can access just a single vector in the array via... x(1, x(2, or x,1) x,2) depending on the array size