Matlab对465KHz的AM信号进行采样和正交解调代码
时间: 2024-05-22 10:12:05 浏览: 88
采样代码:
Fs = 930000; %采样频率
Fc = 465000; %载波频率
t = 0:1/Fs:1; %时间序列
x = sin(2*pi*Fc*t); %原始信号
N = length(x); %信号长度
figure(1);
plot(t,x);
title('原始信号时域波形');
xlabel('时间/s');
ylabel('幅度');
正交解调代码:
fc = 465000; %载波频率
fs = 930000; %采样频率
t = 0:1/fs:1; %时间序列
x = sin(2*pi*fc*t); %原始信号
N = length(x); %信号长度
fc1 = 469000; %正交解调载波频率
fc2 = 461000; %正交解调载波频率
x1 = x.*cos(2*pi*fc1*t); %正交解调信号1
x2 = x.*sin(2*pi*fc2*t); %正交解调信号2
figure(2);
subplot(3,1,1);
plot(t,x);
title('原始信号时域波形');
xlabel('时间/s');
ylabel('幅度');
subplot(3,1,2);
plot(t,x1);
title('正交解调信号1时域波形');
xlabel('时间/s');
ylabel('幅度');
subplot(3,1,3);
plot(t,x2);
title('正交解调信号2时域波形');
xlabel('时间/s');
ylabel('幅度');
相关问题
matlab对465KHz的AM信号进行采样和正交解调
采样:
采样频率应该大于信号的最高频率两倍。因为AM信号的最高频率为465KHz,所以采样频率应该大于930KHz。在Matlab中,可以使用以下代码对AM信号进行采样:
Fs = 2*930000; %采样频率
t = 0:1/Fs:1; %采样时间
carrier = cos(2*pi*465000*t); %载波信号
message = 0.5*sin(2*pi*10*t); %调制信号
am_signal = (1+message).*carrier; %AM信号
正交解调:
将AM信号分成两路,一路和本地载波同频,另一路和本地载波正交。然后将两路信号分别进行低通滤波,得到调制信号。
在Matlab中,可以使用以下代码对AM信号进行正交解调:
%将AM信号分成两路
am_signal1 = am_signal.*cos(2*pi*465000*t);
am_signal2 = am_signal.*sin(2*pi*465000*t);
%低通滤波
[b,a] = butter(10,0.1);
message1 = filter(b,a,am_signal1);
message2 = filter(b,a,am_signal2);
%得到调制信号
message = message1 + 1i*message2;
使用MATLAB对载波频率为465kHz的AM信号进行采样以及正交解调
假设AM信号为s(t),采样频率为fs。则可以用以下MATLAB代码进行采样:
```
fs = 1000; % 采样频率
t = 0:1/fs:1; % 采样时间
fc = 465000; % 载波频率
Ac = 1; % 载波幅度
Am = 0.5; % 调制信号幅度
fm = 1000; % 调制信号频率
s = (Ac + Am*cos(2*pi*fm*t)).*cos(2*pi*fc*t); % AM信号
% 进行采样
Ts = 1/fs; % 采样间隔
n = 0:1:(length(s)-1); % 采样序列
s_sampled = s(n*Ts); % 采样后的信号
```
接下来进行正交解调。首先需要生成正交载波,可以使用cos和sin函数:
```
t = 0:1/fs:1; % 采样时间
fc = 465000; % 载波频率
c1 = cos(2*pi*fc*t); % 正交载波1
c2 = sin(2*pi*fc*t); % 正交载波2
```
然后将采样信号与两个正交载波相乘,并进行低通滤波,得到基带信号:
```
% 进行正交解调
I = s_sampled.*c1; % 乘以正交载波1
Q = s_sampled.*c2; % 乘以正交载波2
% 低通滤波
[b,a] = butter(10,2*fm/fs);
I_filt = filter(b,a,I);
Q_filt = filter(b,a,Q);
% 得到基带信号
s_demod = I_filt - 1i*Q_filt;
```
最后可以绘制采样信号和解调后的信号进行比较:
```
% 绘制采样信号和解调信号
subplot(2,1,1);
plot(t, s_sampled);
xlabel('时间(s)');
ylabel('幅度');
title('采样信号');
subplot(2,1,2);
plot(t, abs(s_demod));
xlabel('时间(s)');
ylabel('幅度');
title('解调信号');
```
运行上述代码可以得到采样信号和解调信号的图形,如下图所示:
![采样信号和解调信号](https://img-blog.csdn.net/2018031919505227)
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)