[SOLVED] Filtering jamming signal

Status
Not open for further replies.

tryipod

Newbie level 3
Joined
Apr 30, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,306
solved-- filter

I have a project to filter a jamming signal
 

Attachments

  • jamming.zip
    244.7 KB · Views: 72
Last edited:

Who can ignore a request like that?

Good evening tryipod,
What an interesting way to pose a problem!
There are so many ways to jam/obscure a signal, I took a guess that your signal was being masked by the addition of something else, and indeed it was... let me paste my solution script here and walk you through it:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% Dejam.m    30 Apr 2012
 
% Load given data file
load('jamming.mat');
 
% Assume jamming accomplished by addition with fixed frequency tone(s)
% (Have a quick look at the spectrum and see what we see)
figure;
pwelch(signal, [],[],[], Fs);
 
% Ah ha!  Two prominant spectral peaks are visible... together with some
% (lower level) features in the human speech range of frequencies.
 
% Create filters to notch out the tones...
% (I initially tried simple low-pass filtering, but it muddied the audio
% to the point of unintelligibility).  The number of poles & bandwidths
% were simply educated guesses and by no means optimal.
filt1 = fdesign.notch('N,F0,BW', 10, 500,  100, Fs); % 500 Hz
filt2 = fdesign.notch('N,F0,BW', 10, 5000, 100, Fs); % 5 kHz
 
oneToneGone = filter(design(filt1), signal);
bothTonesGone = filter(design(filt2), oneToneGone);
 
% Check the spectrum again to make sure the filters did their job...
figure;
pwelch(bothTonesGone, [],[],[], Fs);
 
% Neat!  Let's listen...
sound(bothTonesGone, Fs);
 
% "DSP is cool" eh?  Yes, it is :)




The pwelch() function provides a convenient front-end for spectral estimation tasks - here, I've invoked it with a minimum of arguments to quickly examine the overall form of the file's spectrum. The default parameters are quite useful, and clearly reveal the presence of two equal-amplitude pure tones (at 500 Hz and 5 kHz) in the data. Given their amplitudes were equal I assumed these were the jamming tones, and set out to remove them.

You *can* use fdatool for the filter design (selecting the appropriate filter shape in the 'response type' field at lower left), but here I've specified the filter parameters as arguments to fdesign.xxxxx(); After unsuccessfully low-pass filtering the signal (which certainly hammered the amplitudes of the jamming tones down, but rendered the audio uncomprehensible) I decided to just notch out the tones - and that worked a treat

The sound() function then plays the audio file through the PC's audio output... and there's your answer!

[The result obtained could certainly be improved substantially from this first pass though. Optimisation of the notch order and bandwidth might improve the recovered audio, and using a non-causal filter such as the filtfilt() function would eliminate the audible 'pop' at the start of the audio due to the filter's numerical "startup" overhead.]

Enjoy - it sounds like you've got a good DSP teacher
 
Re:

Thank you so much thylacine1975
I do appreciate your help. I could hear it
 
Last edited:

No, unfortunately you can't use fdatool to examine a signal spectrum - it's just a graphical interface to the filter designing engine. There might be an interactive tool somewhere in MATLAB, but I find pwelch() does everything I need.

[You can find online help about any MATLAB functions with either: doc <function> ...(the verbose, HTML version) or... help <function> ...(the concise, text format)]

doc fft will display the help file for the inbuilt fast fourier transform function, and another approach to spectral estimation is discussed about half-way down the page.

To use fdatool, select a 'notching' response as per the attached screenshot:

You can then export the coefficients using the File/Export... menu selection.
With the coefficients in the workspace, you can filter your signal this way:

>> oneToneGone = filtfilt(Num, Den, signal);

%%% Go into fdatool and design the other filter...

>> bothTonesGone = filtfilt(Num, Den, oneToneGone );

%% Done! Listen with:
>> sound(bothTonesGone, Fs);
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…