Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
 
 
主题工具 显示模式
旧 2008-10-21, 22:22   #1
likeyuaner
初级会员
 
注册日期: 2008-10-21
年龄: 38
帖子: 1
声望力: 0
likeyuaner 正向着好的方向发展
问题 相移法单边信号调制Matlab实现 代码疑问??

相移法单边信号调制Matlab实现 代码应该怎么样改?



% % lssb.m
% Matlab demonstration script for LSSB-AM modulation. The message signal
% is +1 for 0 < t < t0/3, -2 for t0/3 < t < 2t0/3 and zero otherwise.
echo on
t0=.15; % signal duration
ts=0.001; % sampling interval
fc=250; % carrier frequency
snr=10; % SNR in dB (logarithmic)
fs=1/ts; % sampling frequency
df=0.25; % desired freq. resolution
t=[0:ts:t0]; % time vector
snr_lin=10^(snr/10); % SNR
% the message vector
m=[ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)];
c=cos(2*pi*fc.*t); % carrier vector
udsb=m.*c; % DSB modulated signal
[UDSB,udssb,df1]=fftseq(udsb,ts,df); % Fourier transform
UDSB=UDSB/fs; % scaling
f=[0:df1:df1*(length(udssb)-1)]-fs/2; % frequency vector
n2=ceil(fc/df1); % location of carrier in freq. vector
% remove the upper sideband from DSB
UDSB(n2:length(UDSB)-n2)=zeros(size(UDSB(n2:length(UDSB)-n2)));
ULSSB=UDSB; % generate LSSB-AM spectrum
[M,m,df1]=fftseq(m,ts,df); % Fourier transform
M=M/fs; % scaling
u=real(ifft(ULSSB))*fs; % generate LSSB signal from spectrum
signal_power=spower(udsb(1:length(t)))/2;
% % compute signal power
noise_power=signal_power/snr_lin; % compute noise power
noise_std=sqrt(noise_power); % compute noise standard deviation
noise=noise_std*randn(1,length(u)); % generate noise vector
r=u+noise; % add the signal to noise
[R,r,df1]=fftseq(r,ts,df); % Fourier transform
R=R/fs; % scaling
pause % Press a key to show the modulated signal power
signal_power
pause % Press any key to see a plot of the message signal
clf
subplot(2,1,1)
plot(t,m(1:length(t)))
axis([0,0.15,-2.1,2.1])
xlabel('Time')
title('The message signal')
pause % Press any key to see a plot of the carrier
subplot(2,1,2)
plot(t,c(1:length(t)))
xlabel('Time')
title('The carrier')
pause % Press any key to see a plot of the modulated signal and its spectrum
clf
subplot(2,1,1)
plot([0:ts:ts*(length(u)-1)/8],u(1:length(u)/8))
xlabel('Time')
title('The LSSB-AM modulated signal')
subplot(2,1,2)
plot(f,abs(fftshift(ULSSB)))
xlabel('Frequency')
title('Spectrum of the LSSB-AM modulated signal')
pause % Press any key to see the spectra of the message and the modulated signals
clf
subplot(2,1,1)
plot(f,abs(fftshift(M)))
xlabel('Frequency')
title('Spectrum of the message signal')
subplot(2,1,2)
plot(f,abs(fftshift(ULSSB)))
xlabel('Frequency')
title('Spectrum of the LSSB-AM modulated signal')

pause % Press any key to see a noise sample
subplot(2,1,1)
plot(t,noise(1:length(t)))
title('noise sample')
xlabel('Time')
pause % Press a key to see the modulated signal and noise
subplot(2,1,2)
plot(t,r(1:length(t)))
title('Modulated signal and noise')
xlabel('Time')
subplot(2,1,1)
pause % Press any key to see the spectrum of the modulated signal
plot(f,abs(fftshift(ULSSB)))
title('Modulated signal spectrum')
xlabel('Frequency')
subplot(2,1,2)


pause % Press a key to see the modulated signal noise in freq. domain
plot(f,abs(fftshift(R)))
title('Modulated signal noise spectrum')
xlabel('Frequency')
likeyuaner 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码


相似的主题
主题 主题作者 版面 回复 最后发表
[求助]labview, 如何在几个自己编写的subvi中,传输ActiveX的信号 zztc2003 LabVIEW论坛 1 2009-03-16 08:23
如何实现gui窗口嵌套 beulah MATLAB论坛 1 2008-12-28 17:57
[求助]如何以图片名称的时间自动依序读入判断 dean0204 MATLAB论坛 0 2008-12-14 20:33
[求助]请问谁会用matlab模拟一个泊松过程? jarod520 MATLAB论坛 0 2008-12-10 18:53
[求助]如何快速的解线性方程组? liujinhua MATLAB论坛 0 2008-12-10 18:44


所有时间均为北京时间。现在的时间是 11:25


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.