code:
echo on
t0=.2;% signal duration
ts=0.001;% sampling interval
fc=250;% carrier frequency
snr=20;% SNR in dB (logarithmic)
fs=1 /ts;% sampling frequency
df=0.3;% required freq. resolution
t=[-t0/2:ts:t0/2];% time vector
kf=100;% deviation constant
df=0.25;% required frequency resolution
m=sinc(100*t);% the message signal
int_m(1)=0;% integral of m
for i=1 :length(t)-1
`int_m(i+1)=int_m(i)+m(i)*ts;
echo off ;
end
echo on;
[M,m,dfl]=fftseq(m,ts,df); % Fourier transform
M=M/fs; % scaling
f=[0:dfl :dfl *(length(m)-1 )]-fs/2; % frequency vector
u=cos(2*pi*fc*t+2*pi*kf*int_m); % modulated signal
[U,u,dfl]=fftseq(u,ts,df); % Fourier transform
U=U/fs; % scaling
[v,phase]=env_phas(u,ts,250); % demodulation, find phase of u
phi=unwrap(phase); % Restore original phase.
dem=(1/(2*pi*kf))*(diff(phi)/ts); % demodulator output, differentiate and scale phase
pause % Press any key to see a plot of the message and the modulated signal.
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')
pause % Press any key to see plots of the magnitude of the message and the
% modulated signal in the frequency domain.
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')
pause % Press any key to see plots of the message and the demodulator output with no
% noise.
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')
增加2个function
1.
function[v,phi]=env_phas(x,ts,f0)
if nargout == 2
z=loweq(x,ts,f0);
phi=angle(z);
end
v=abs(hilbert(x));
2.
function xl=loweq(x,ts,f0)
t=[0:ts:ts*(length(x)-1)];
z=hilbert(x);
xl=z.*exp(-j*2*pi*f0*t);
调频信号具有恒定幅度。然而,在图 3.26 中
信号 u(t) 的幅度显然不是恒定的,想请问一下为什么?
谢谢!
你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答
本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。
因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。