Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Quick Matlab Systems and Signals Help I need help finding out exactly what my ma

ID: 2250297 • Letter: Q

Question

Quick Matlab Systems and Signals Help

I need help finding out exactly what my matlba code is doing. Here is the code:

%Using the code provided we will use create signal "Chirper"
t = linspace(0,5,40960); % Making a 5 Second Clip

% The following will putt in 8 frequencies from 1kHz to 8kHz
f=[1000*ones(1,5120) 2000*ones(1,5120) 3000*ones(1,5120) 4000*ones(1,5120) 5000*ones(1,5120) 6000*ones(1,5120) 7000*ones(1,5120) 8000*ones(1,5120)];
  
plot(t,f) % This will plot the frequencies
chirper=cos(2*pi*f.*t);

soundsc(chirper,8192);

% Step 2
figure, specgram(chirper, [], 8192)

My two questions are: 1) Why does the sound that this creates in step 1 not match up with the frequencies that are being shown in the graph it produces.

2) In step 2, what exactly is this figure showing me and at qhat frequencies are the tones actually appearing.

I know these are simple and the code works fine so the graphs should pop up for you. I just need help understanding them.

thanks!

Explanation / Answer

1) The sampling frequency of given signal is Fs=8kHz. So the maximum frequency that can be obtained is Fs/2 = 4kHz. Because you have give above 4kHz aliasing occured which resulted in wrong frequency representation.

To overcome this we have to maintain Fs >= 2Fm (Niquist Crierion).

2) Tones are appearing at frequencies 1kHz, 2kHz, 3kHz, 4kHz, 3.45kHz, 2.3kHz, 1.2kHz, 240Hz.