discrete time signal

Sampling involves converting continuous-time signals into discrete-time representations, adhering to the Nyquist-Shannon theorem
3 Downloads
Updated 10 Apr 2024

View License

Sampling converts continuous-time signals to discrete-time, following Nyquist-Shannon theorem for fidelity. Filtering, using FIR/IIR methods, alters signal frequency content selectively. These operations are vital in digital signal processing and telecommunications, enabling accurate signal conversion, processing, and transmission. Mastery of sampling and filtering principles is crucial for designing efficient digital systems across diverse applications.
% Parameters
Fs = 10; % Sampling frequency
t = 0:1/Fs:1; % Time vector
f1 = 0.1; % Frequency of the input signal
f2 = 1; % Frequency of the carrier signal
A = 0.01; % Amplitude of the input signal
% Generate input signal
x = A*sin(2*pi*f1*t);
% Modulate the signal
y = x .* sin(2*pi*f2*t);
% Plot the input signal
subplot(3,1,1);
plot(t,x);
title('Input Signal');
xlabel('Time (s)');
ylabel('Amplitude');
% Plot the modulated signal
subplot(3,1,2);
plot(t,y);
title('Modulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');
% Sampling
Fs_new = 200; % New sampling frequency
t_new = 0:1/Fs_new:1; % New time vector
y_sampled = interp1(t,y,t_new); % Sample the modulated signal
% Plot the sampled signal
subplot(3,1,3);
stem(t_new,y_sampled);
title('Sampled Signal');
xlabel('Time (s)');
ylabel('Amplitude');
% Filter the sampled signal
fc = 50; % Cut-off frequency of the filter
[b,a] = butter(5,fc/(Fs_new/2)); % Design a low-pass Butterworth filter
y_filtered = filter(b,a,y_sampled); % Apply the filter
% Plot the filtered signal
figure;
subplot(2,1,1);
stem(t_new,y_sampled);
title('Sampled Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(2,1,2);
stem(t_new,y_filtered);
title('Filtered Signal');
xlabel('Time (s)');
ylabel('Amplitude');

Cite As

Thamilmaran (2025). discrete time signal (https://in.mathworks.com/matlabcentral/fileexchange/163116-discrete-time-signal), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Filter for discrete time signal

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0