| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1529 人关注过本帖
标题:BPSK循环谱程序优化改错的(附程序和优化要求和简单的程序说明)
只看楼主 加入收藏
keithchin
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-7-1
收藏
 问题点数:0 回复次数:1 
BPSK循环谱程序优化改错的(附程序和优化要求和简单的程序说明)

BPSK循环谱

现有程序需要优化改错

现在的问题主要有以下几个:

1. 程序运行速度慢
2. 有一个参数M,在M取2,4时,均能运行得到正确的结果,但是当M取8以上时,运行出错,并且M值取不同的时候程序的错误不同,具体的你可以试试。
你的主要任务,是将错误产生的原因找出来并改正,错误消除了以后再进行程序的进一步优化工作。

谢谢各位达人了...



%数据设置部分
Rb=2; %码源速率
Ts=1/Rb; %码源间隔
L=2^6; %单位时间内信号抽样点数
num=16; %一个段落中码源个数
N=num*L; %一个段落内总的抽样点数

f0=16; %载波频率
dt=Ts/L; %抽样时间间隔
df=1/(dt*N); %频率间隔
Bs=df*N/2; %带宽
fs=Bs*2;
f=df/2-Bs:df:Bs; %抽样频率
t=dt/2:dt:num*Ts; %抽样时间
a=sign(randn(1,num)); %码源序列

%BPSK调制信号产生
%通过基带成型滤波器后的信号
for rr=1:num
I((rr-1)*L+1:rr*L)=a(rr);
end
%最终调制信号
s=I.*cos(2*pi*f0*t);

M=2;
Fs=fs;

N = (M*Fs)/df;
N = pow2 (nextpow2(N)); % windowing record for FFT

%N=; %设置FFT点数为1024

X = fft(s,N); % fft of the truncated (or zero padded) time series
X = fftshift(X);% shift components of fft
Xc = conj(X); % precompute the complex conjugate vector

S = zeros (N,N); % size of the Spectral Correlation Density matrix
f = zeros (N,N); % size of the frequency matrix;
alfa = zeros (N,N); % size of the cycle frequency matrix
F = Fs/(2*N); % precompute constants - F = Fs/(2*N);
G = Fs/N; % precompute constants - G = Fs/N;
m = -M/2+1:M/2; % set frequency smoothing window index

for k = 1:N % fix k
% computes vectors of f and alfa,
% store frequency and cycle frequency data for given k.

k1 = 1:N;
f(k,k1) = F*(k+k1-1) - Fs/2; % Computes f values and shift them to center in zero (f = (K+L)/2N) [1]
alfa(k,k1) = G*(k-k1 + N-1) - Fs; % Computes alfa values and shift them to center in zero (alfa = (K-L)/N) [1]

for k1 = 1:N %fix k1 = J
%calculate X(K+m) & conj (X(J+m)) for arguments of X(1:N) only
B = max(1-k, 1-k1); % Largest min of 1 <= (K+m)| (J+m) <= N
A = min (N-k, N-k1); % Smallest max of 1 <= (K+m)| (J+m) <= N
n = m((m<=A) & (m>=B)); %fix the index out of range problem by
% truncating the window
if isempty(n)
S(k,k1) = 0;
else
p = k+n; q = k1+n;
Y = X(p).*Xc(q);
S(k,k1) = sum(Y);
end
end
end

S = abs(S./max(max(S)));% normalize output matrix
% figure(1);
% contour (alfa, f, S); grid;
figure(1);
mesh(alfa, f, S);
ylabel('Frequency (Hz)');xlabel('Cycle frequency (Hz)');
title('BPSK循环谱三维图');

VpEPwAXK.rar (6.48 KB) BPSK循环谱程序优化改错的(附程序和优化要求和简单的程序说明)


搜索更多相关主题的帖子: BPSK 程序优化 改错 任务 num 
2006-07-01 14:33
songbaoxiang
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-3-28
收藏
得分:0 
回复:(keithchin)BPSK循环谱程序优化改错的(附程序...
你的bpsk信号我觉得做的好像就不太对,并且最后运行结果也有点问题
你在看一下,只是个人观点
2007-04-01 11:33
快速回复:BPSK循环谱程序优化改错的(附程序和优化要求和简单的程序说明)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012163 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved