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');
引用格式
Thamilmaran (2024). discrete time signal (https://www.mathworks.com/matlabcentral/fileexchange/163116-discrete-time-signal), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2024a
兼容任何版本
平台兼容性
Windows macOS Linux标签
致谢
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0 |