Fig : 1 Fig(a): plot of 4 cycle sinusoid with 1000 Hz frequency and sampled curve with sampling rate of 16000 Hz.
Fig 2
Figure:
Figure: Convoluted output of given signals
Solution:
Code:
clear all
fc=1000; %provided for 1000KHz Sinusoid
fs=16000; %sampling rate 16KHz
T=1/1000; %Time period /singel cycle time duration of Sinusoid
ts=(1/16000); % sampling time interval for every sample
t1=0:ts:(4*T)-ts; %time vector for desired 4 cycles.(4*T)
x=sin(2*pi*fc*t1); %sine wave function with fc frequency
subplot(2,1,1)
plot(t1,x); % command to plot the 4 cyceles signal only
subplot(2,1,2) %for subplot window
plot(t1,x); %to plot again with sampled view
hold on; %to hold the previous plot
stem(t1,x); %to see the sampled signal to count number of sample per period
Ln=length(t1) %to count length of amplitude and time vector
a)
Figure:
Fig(a): plot of 4 cycle sinusoid with 1000 Hz frequency and sampled curve with sampling rate of 16000 Hz.
Explanation:
b) from the second curve its clear to count number of sample is 16 .
again we can also count by theoryticallly time period of a single cycle T=1/1000 , sampling rate is 16000 so time interval of every sample is ts=1/16000. And number of sampler in one period =T/ts=16 .
c) ) length of time vector =64 (formula provide in the code.)
clear all
fc=15000; %frequency of sainusoid given 15KHz
fs=16000; %sampling rate is 16KHz
ts=1/16000; %sampling rate or interval
t=0:ts:(64*ts)-ts; % stop time is multiple of sampling interval and
%number sample we want.
%in our preivious solution we found number of sample
%is 64. so in this case time duration is (ts*number
%of sample)
x=sin(2*pi*fc*t); % sinusoidal signal of frequency fc
plot(t,x);
Explanation:
Given sampling frequency if 16KHz and signal max frequency is 15KHz .
According to Nyquist criteria signal need to sample with sampling rate of at
least ( > 2Fs) two times of max frequency od the signal . But in this problem 16 KHz is not equal or greater than (2*15KHz =30KHz) . So sampling rate does not follow the Nyquist criteria. Although signal is 15 KHz but we found an alias of the signal which is 1000Hz from the curve.
From the we found T=0.001s and frequency F=1/T =1000 Hz
3.
Solution:
Code:
%task 3:
clear all
fc=1000; % frequency of sinusoid signal
T=1/fc; %period of sinusoidal
fs=16000;
ts=1/16000;
t=0:ts:(20*ts)-ts;%to truncate into 20 samples
x=sin(2*pi*fc*t);% sinusoid with fc frequency
t1=0:ts:20*ts-ts;% time vector of impulse response with 20 samplse truncate
x1=exp(-1000*t1);%impulse function
subplot(2,1,1)
plot(t,x)
hold on
%plot(t1,x1); %impulse plot
%x(21:end)=[]
%x1(21:end)=[]
y=conv(x,x1);
subplot(2,1,2)
plot(y)
Explanation:
According to question we need to take all the sampling criteria and after tha to truncate for 20 samples we need to formulate for 2o time interval shown in the code.
Figure:
Figure: Convoluted output of given signals