% Parameters
omega_a = 0.1*pi;
omega_b = 0.05*pi;
omega_I = 0.5*pi;
omega_Q = 0.5*pi;
fs = 1000; % Sampling frequency
T = 1/fs; % Sampling period
t = 0:200; % Time vector
% Generate input signals
x1 = cos(omega_a*t);
x2 = sin(omega_b*t);
% Modulation
modulated_signal = x1 .* cos(omega_I*t) - x2 .* sin(omega_Q*t);
% Demodulation
demodulated_x1 = modulated_signal .* cos(omega_I*t);
demodulated_x2 = -modulated_signal .* sin(omega_Q*t);
% Butterworth lowpass filter design
cutoff_freq = 0.15*pi; % Adjust as needed
order = 4;
[b, a] = butter(order, cutoff_freq);
% Apply filter to regenerate input message signals
filtered_x1 = filter(b, a, demodulated_x1);
filtered_x2 = filter(b, a, demodulated_x2);
% Plot the results
figure;
subplot(1,1,1);
plot(t, x1,'r',t, x2,'g');
title('Original x1[n] and x2[n]');
xlabel('Time');
ylabel('Amplitude');
legend('x1[n]', 'x2[n]');
figure;
subplot(1,1,1);
plot(t, modulated_signal);
title('Modulated Signal');
xlabel('Time');
ylabel('Amplitude');
figure;
subplot(1,1,1);
plot(t, filtered_x1, 'r', t, filtered_x2, 'g');
title('Filtered Demodulated Signals');
xlabel('Time');
ylabel('Amplitude');
legend('Filtered x1[n]', 'Filtered x2[n]');
figure;
subplot(2,1,1);
plot(t, demodulated_x1);
title('demodulated x1');
xlabel('Time');
ylabel('Amplitude');
2023-07-28
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 好好生活,让自己知足常乐,如此,才能享受生活的幸福。我们都知道,人生没有重来时,岁月也不会为谁而停留,人生没有如果...