Back to Browse

Sampling and Aliasing Explained Using MATLAB & Audio Signal Processing | ADC 4.3

12.3K views
Jun 10, 2020
10:01

Sampling and aliasing explained using audio signal in a MATLAB simulation. Matlab code is in description of this video. In this video, we look into time domain and frequency domain plots to perform analysis of audio signal and provide matlab code of sampling and also effect of aliasing on an audio signal. Also, anti-aliasing filter is discussed briefly. In this video, the audio signal is down sampled with respect to the Nyquist theorem and the role of aliasing filter is shown by showcasing aliasing in matlab and what measures to be taken to reduce the aliasing effect. Aliasing in sampling is central in signals and systems, communication systems and digital signal processing dsp among other courses. For further understanding of what is anti aliasing, anti aliasing filter, and anti aliasing vs no anti aliasing see the other video on the following link. https://youtu.be/68mDIdFYfuk #Sampling #Aliasing #MATLAB The MATLAB code of audio sampling and aliasing is given below. clear all;close all; clc [y,Fs] = audioread('Anwar_Masood.wav'); %Random audio file info = audioinfo('Anwar_Masood.wav') %Information about the audio %Time Domain Analysis t = 0:seconds(1/Fs):seconds(info.Duration); %Time array t = t(1:end-1); %Time index adjustment %%% Time Domain Plot figure(1); subplot(2,1,1); plot(t,y); xlabel('Time'); ylabel('Audio Signal') % Compute the Fourier transform of the signal first Y = fft(y); L = info.TotalSamples; P2 = abs(Y/L); P1 = P2(1:L/2+1); P1(2:end-1) = 2*P1(2:end-1); f = Fs*(0:(L/2))/L; %Single side spectrum %%% Frequency Domain Plot figure(1); subplot(2,1,2); plot(f,P1) title('Single-Sided Amplitude Spectrum of y(t)') xlabel('f (Hz)'); ylabel('|P1(f)|') keyboard sound(y,Fs); keyboard q = 1; p =20; % q and p identify up sampling, and down sampling respectively [y1,af1] = resample(y,q,p) ; sound(y1,Fs); keyboard %downsample [y2,af2] = resample(y1,p,q); sound(y2,Fs); keyboard %interpolate %plot for showing the sampling information figure(2) t1 = 0:(1/Fs):(info.Duration); t1 = t1(1:end-1); t2 = (0:(length(y1)-1))*p/(q*Fs); plot(t1(1:100),y(1:100,1),'-b*',t2(1:(100/p)+1),y1(1:100/p+1,1),'-ro') title('Sampling Info') legend('Original','Resampled', 'Location','South') keyboard figure(3) freqz(af1)

Download

0 formats

No download links available.

Sampling and Aliasing Explained Using MATLAB & Audio Signal Processing | ADC 4.3 | NatokHD