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

Consider the following signal x(t) = sin(2 pi f_0 t + pi mu t^2) which is often

ID: 2079980 • Letter: C

Question

Consider the following signal x(t) = sin(2 pi f_0 t + pi mu t^2) which is often called a chirp signal due to the noise it produces when played through a loud speaker. This sound is a result of the increase of the instantaneous frequency with time. The instantaneous frequency is given by f_1(t) = 1/2 pi d/dt (2 pi f_0 t + pi mu t^2) = f_0 + mu t Assume that the sampling frequency used to sample the chirp is f_0 = 8,000 Hz. b. Select f_0 = 3,00 Hz as the starting frequency and mu = 2500 as the chip rate (rate of frequency increase). Create a vector x and in it the samples of x(t) for the time period 0 lessthanorequalto t lessthanorequalto 1. i) What is the range of frequencies covered by the swept frequency of the chip? Do you expect to see aliasing? Explain. j) Use sound (x, f_0) to the chirp signal. Explain what you heard? k) Using the instantaneous frequency formula and you knowledge about aliasing, find the time where the chirp kits its maximum pitch. Confirm this by listening to the chirp signal. l) Allow the time duration of the chirp to be 5 seconds instants 1 second and play the signal gain using sound. Explain what you beard.

Explanation / Answer

clc;
close all;
clear all;

fs = 8000; %SAMPLING FREQUENCY
dt = 1/fs; %SAMPLING TIME
f0 = 3000; %STARTING FREQUENCY
mu = 2500; %CHIRP RATE

%QUESTION h
t = 0 : dt : 1;
xt = sin((2*pi*f0*t)+(pi*mu*t.^2));

figure(1);
subplot(2,1,1);
plot(t,xt);

%QUESTION i
f1t = (2*pi*f0*t) + (pi*mu*(t.^2));
subplot(2,1,2);
stem(t,f1t);
display(f1t);

fmax = max(f1t);

if fs > (2*fmax)
    display ('No aliasing');
else
    display ('Aliasing');
end

%Aliasing will happen since sampling frequency, fs is less than 2 * maximum(f1t)

%QUESTION j
sound(xt,8000);
%A low whistling type sound will be heard.

%QUESTION k
%CODE TO FIND THE PITCH USING AUTOCORRELATION METHOD
y = xt;
Fs = 8000;
max_value=max(abs(y));
y=y/max_value;
t=(1/Fs:1/Fs:(length(y)/Fs))*1000;

sum1=0;autocorrelation=0;
   for l=0:(length(y)-1)
    sum1=0;
    for u=1:(length(y)-l)
      s=y(u)*y(u+l);
      sum1=sum1+s;
    end
    autocor(l+1)=sum1;
end
kk=(1/Fs:1/Fs:(length(autocor)/Fs))*1000;
auto=autocor(21:160);
max1=0;
for uu=1:140
    if(auto(uu)>max1)
      max1=auto(uu);
      sample_no=uu;
    end
end
pitch_period_To=(20+sample_no)*(1/Fs)
pitch_freq_Fo=1/pitch_period_To
%END OF PITCH CODE

%SINCE THE PITCH IS LESS, IT IS NOT DISTINGUISHABLE

%QUESTION l
pause(5); %PAUSE ADDED TO DIFFERENTIATE BETWEEN 2 CHIRPS
t = 0 : dt : 5;
x = sin((2*pi*f0*t)+(pi*mu*t.^2));
sound(x,8000);
%A low whistling type sound will be heard. The volume of the whistle will
%go up and becomes 0 and the same whistling sound will be heard again with
%the volume going low to High and back to low