f_continuous = 50;
t_continuous = 0:1/1000:0.1;
x_continuous = sin(2*pi*f_continuous*t_continuous);
fs_high = 200;
fs_low = 60;
t_high = 0:1/fs_high:0.1;
t_low = 0:1/fs_low:0.1;
x_high = sin(2*pi*f_continuous*t_high);
x_low = sin(2*pi*f_continuous*t_low);
figure;
subplot(3,2,1);
plot(t_continuous, x_continuous, 'b');
title('Continuous Signal');
subplot(3,2,2);
stem(t_high, x_high, 'r');
title('Sampled (High Rate)');
subplot(3,2,3);
stem(t_low, x_low, 'r');
title('Sampled (Low Rate)');
subplot(3,2,4);
plot(abs(fftshift(fft(x_continuous))));
title('Spectrum: Continuous');
subplot(3,2,5);
plot(abs(fftshift(fft(x_high))));
title('Spectrum: High Sampling');
subplot(3,2,6);
plot(abs(fftshift(fft(x_low))));
title('Spectrum: Low Sampling');
To embed this project on your website, copy the following code and paste it into your website's HTML: