📄 fm.m
字号:
fc=1000;
ts=0.001;
fs=1/ts;
df=0.25;
kf=100;
%调制信号
t1=[0:ts:1];
t2=[1:ts:2];
t=[t1,t2];
m1=t1;
m2=-t2+2;
m=[m1,m2];
int_m(1)=0;
for i=1:length(t)-1
int_m(i+1)=int_m(i)+m(i)*ts;
end
[M,m,df1]=fftseq(m,ts,df);
M=M/fs;
f=[0:df1:df1*(length(m)-1)]-fs/2;
u=cos(2*pi*fc*t+2*pi*kf*int_m);
[U,u,df1]=fftseq(u,ts,df);
U=U/fs;
[v,phase]=env_phas(u,ts,250);
phi=unwrap(phase);
dem=(1/(2*pi*kf))*(diff(phi)/ts)
figure;
subplot(2,1,1);
plot(t,m(1:length(t)));
xlabel('Time');
title('The message signal');
subplot(2,1,2);
plot(t,u(1:length(t)));
xlabel('Time');
title('The modulated signal');
figure;
subplot(2,1,1);
plot(f,abs(fftshift(M)));
xlabel('Frequency');
title('Magnitude spectrum of the message signal');
subplot(2,1,2);
plot(f,abs(fftshift(U)));
title('Magnitude spectrum of the modulated signal');
xlabel ('Frequency');
figure;
subplot(2,1,1);
plot(t,m(1:length(t)));
xlabel('Time');
title('The message signal');
subplot(2,1,2);
plot(t,dem(1:length(t)));
xlabel('Time');
title('The demodulated signal');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -