% 设置采样时间间隔 T = 0.1;
% 生成时间序列 t = 0 : T : 10;
% 生成正弦信号 x1 = 5 * cos(2pit/3 + pi/2) + 5 * sin(2pit/3 + pi/2);
% 绘制连续信号波形 subplot(3,1,1); plot(t, x1); title('Continuous Sine Signal'); xlabel('Time (s)'); ylabel('Amplitude');
% 进行离散化:采样 n = length(t); x1_sampled = zeros(1, n); for i = 1 : n x1_sampled(i) = 5 * cos(2pit(i)/3 + pi/2) + 5 * sin(2pit(i)/3 + pi/2); end
% 绘制离散信号采样样本 subplot(3,1,2); stem(t, x1_sampled, 'filled', 'MarkerSize', 4); title('Discrete Sampled Sine Signal'); xlabel('Time (s)'); ylabel('Amplitude');
% 生成指数信号 x2 = 2 * exp(-0.5t) . cos(3*t + 4j);
% 绘制连续信号波形 subplot(3,1,3); plot(t, x2); title('Continuous Exponential Signal'); xlabel('Time (s)'); ylabel('Amplitude');
% 进行离散化:采样 x2_sampled = 2 * exp(-0.5t) . cos(3*t + 4j);
% 绘制离散信号采样样本 figure; stem(t, x2_sampled, 'filled', 'MarkerSize', 4); title('Discrete Sampled Exponential Signal'); xlabel('Time (s)'); ylabel('Amplitude');
% 生成抽样信号(Sinc 函数) x3 = 5 * sinc(5*t / pi);
% 绘制连续信号波形 figure; plot(t, x3); title('Continuous Sampled Signal (Sinc Function)'); xlabel('Time (s)'); ylabel('Amplitude');
% 进行离散化:采样 x3_sampled = 5 * sinc(5*t / pi);
% 绘制离散信号采样样本 figure; stem(t, x3_sampled, 'filled', 'MarkerSize', 4); title('Discrete Sampled Signal (Sinc Function)'); xlabel('Time (s)'); ylabel('Amplitude');