- UID
- 3495
- 帖子
- 712
- 精华
- 0
- 积分
- 2310
- 阅读权限
- 10
- 性别
- 男
- 在线时间
- 679 小时
- 注册时间
- 2006-8-3
- 最后登录
- 2016-12-19
|
142楼
发表于 2008-11-17 18:16
| 只看该作者
备份
clear all;
clc;
clf;
%parameters
ts=1/1000;
fs=1/ts;
fc=250;
T1=-0.1; T2=0.1;
t=[T1:ts:T2];
N=length(t);
snr=20;
%time domain
%message signal
tau=0.1;
message=zeros(size(t));
midpoint=floor((T2-T1)/2/ts)+1;
L1=midpoint-fix(tau/2/ts);
L2=midpoint+fix(tau/2/ts)-1;
message(L1:midpoint)=(2/tau)*t(L1:midpoint)+1;
message(midpoint+1:L2)=-(2/tau)*t(midpoint+1:L2)+1;
%frequency domain
resolution=1/(N*ts);
f=[0:resolution:fs-1]-fs/2;
%carrier
carrier=cos(2*pi*fc.*t);
%message signal
figure(1)
subplot(2,1,1)
plot(t,message)
Message_freq=fft(message,N);
Message_freq=Message_freq/fs;
subplot(2,1,2)
plot(f,abs(fftshift(Message_freq)))
%1. Ac>0
Ac=2;
figure(2)
subplot(2,1,1)
%modulation signal
tc_mod_sig=message.*carrier+Ac*carrier; % modulated signal--Sam(t)
plot(t,tc_mod_sig(1:N))
subplot(2,1,2)
%Modulation signal in frequency domain
Tc_mod_sig=fft(tc_mod_sig,N);
Tc_mod_sig=Tc_mod_sig/fs;
plot(f,abs(fftshift(Tc_mod_sig(1:length(t)))))
%2. -1<Ac<0
Ac=-0.4;
figure(3)
subplot(2,1,1)
%modulation signal
tc_mod_sig=message.*carrier+Ac*carrier;
plot(t,tc_mod_sig(1:N))
subplot(2,1,2)
%Modulation signal in frequency domain
Tc_mod_sig=fft(tc_mod_sig,N);
Tc_mod_sig=Tc_mod_sig/fs;
plot(f,abs(fftshift(Tc_mod_sig(1:length(t)))))
%3.Ac=-1
Ac=-1;
figure(4)
subplot(2,1,1)
%modulation signal
tc_mod_sig=message.*carrier+Ac*carrier;
plot(t,tc_mod_sig(1:N))
subplot(2,1,2)
%Modulation signal in frequency domain
Tc_mod_sig=fft(tc_mod_sig,N);
Tc_mod_sig=Tc_mod_sig/fs;
plot(f,abs(fftshift(Tc_mod_sig(1:length(t)))))
%4. Ac<-1
Ac=-2;
figure(5)
subplot(2,1,1)
%modulation signal
tc_mod_sig=message.*carrier+Ac*carrier;
plot(t,tc_mod_sig(1:N))
subplot(2,1,2)
%Modulation signal in frequency domain
Tc_mod_sig=fft(tc_mod_sig,N);
Tc_mod_sig=Tc_mod_sig/fs;
plot(f,abs(fftshift(Tc_mod_sig(1:length(t))))) |
|