⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uwb_imr.m

📁 超宽带UWB,包括:uwb.mdl: UWB model - open this to begin. uwb_lib.mdl: Library blocks for UWB model. uwb_
💻 M
字号:
function h = uwb_imr(chan, ch_idx, plot_imr)

% The first step is to read in the data from the .mat files supplied by the
% IEEE 802.15.3a working group
%
if chan==1,
    load cm1_imr.mat;
elseif chan==2,
    load cm2_imr.mat;
elseif chan==3,
    load cm3_imr.mat;
elseif chan==4,
    load cm4_imr.mat;
else
    error('Unrecognized UWB channel number.');
end

% The second step is to reinterpolate the data from the unequally spaced
% points in the .mat file to a set of points spaced at the simulation
% sampling interval.

% Define the sampling time
Ts = 3.125e-7/990;

% If the user has entered a valid channel index in the range 1 to 100,
% extract the corresponding column of data from each of the matrices 
% and reinterpolate it.
if ch_idx>=1 && ch_idx<=100
    % Extract the correct columns from the data 
    % h_ct and t_ct are the "continuous-time" impulse response sample and
    % sampling times, respectively.
    z = h_ct(:,ch_idx);
    tau = t_ct(:,ch_idx)*1e-9;
    % x1 is the time-sampled data normalized to the regular sampling interval
    % x2 is a grid of points to be used for sinc interpolation
    x1 = tau/Ts;
    x2 = [-10:489];
    % Build up the impulse response one point at a time.  Each point in the
    % reinterpolated impulse response contains a contribution from every
    % point in the original impulse response, weighted by the sinc
    % function.
    h = zeros(500,1);
    for h_idx = 1:500,
        h(h_idx) = my_sinc(x1-x2(h_idx)).'*z;
    end
else
    error('Channel index must be in the range 1 to 100.');
end

% Normalize the result so that the total energy in the impulse response is
% unity.
h = h/sqrt(h'*h);

% Take the real bandpass impulse response and convert it to a complex
% baseband equivalent.

% Set the carrier frequency to be the middle of band 2, 3960 MHz.
FcTs = 3960e6*Ts;

% Translate the data from passband to baseband.
h = h.*exp(j*2*pi*FcTs*[1:500]');

% Truncate the start of the response to remove any delay introduced in the
% reinterpolation process.
gd = min(find(h>0.05*max(abs(h))));

% Keep the length of the impulse response fixed to allow "on-the-fly"
% channel changes in Simulink.
h = [h(gd:end);zeros(gd-1,1)];

% If the simulation is stopped, plot the impulse response.
if plot_imr
simstatus = get_param(gcs,'simulationstatus');
if(strcmp(simstatus,'stopped')),
    figure;plot(Ts/1e-9*[1:480]/6,abs(h(1:480)),[32 32]*Ts/1e-9,[0 0.5],'r--');
    xlabel('Delay (ns)');
    ylabel('Power');
    title('Channel Response');
    drawnow
end
end

% A small change to the sinc function for speed.
function y=my_sinc(x)
i=find(x==0);
x(i)=1;
y=sin(pi*x)./(pi*x);
y(i)=1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -