1 简介

Matlab生成宽带信号

2 完整代码

%

% FUNCTION 1.2 : "gaosi_bandwidth"

%

% Evaluates the bandwidth of the input 'signal' with sampling period

% 'dt'

% Bandwidth is evaluated according to the given 'threshold' (in dB)

% 'BW' is the bandwidth

% 'f_high' is the higher limit

% 'f_low' is the lower limit

%

% Programmed by Guerino Giancola

%

function [ss_E,f_high,f_low,BW] = ...

   wideBAND(signal,dt,threshold)

% -----------------------------------------------------------------

% Step One - Evaluation of the single-sided Energy Spectral Density

% -----------------------------------------------------------------

dt=1000;

TT=1:dt;

signal=sin(TT);

threshold=0.51;

fs = 1 / dt;         % sampling frequency

N = length(signal);  % number of samples (i.e. size of the FFT)

T = N * dt;          % time window

df = 1 / T;          % fundamental frequency

X = fft(signal); % double-sided MATLAB amplitude spectrum

X = X/N;         % conversion from MATLAB spectrum to fourier spec-trum

ds_E = abs(X).^2/(df^2);      % DOUBLE-SIDED ENERGY SPECTRAL DENSITY

ss_E = 2.*ds_E(1:floor(N/2)); % SINGLE-SIDED ENERGY SPECTRAL DENSITY

% ------------------------------------------------

% Step Two - Evaluation of the frequency bandwidth

% ------------------------------------------------

[Epeak,index] = max(ss_E);      % Epeak is the peak value of the ESD

f_peak = index * df;            % peak frequency   

Eth = Epeak*10^(threshold/10);  % Eth is the value of the ESD

                                % corresponding to the given

                                %  threshold

% iterative algorithm for evaluating high and low frequencies

imax = index;

E0h = ss_E(index);

while (E0h>Eth)&(imax<=(N/2))

    imax = imax + 1;

    E0h = ss_E(imax);

end % while E0h > Eth

f_high = (imax-1) * df;             % High Frequency

imin = index;

E0l = ss_E(index);

while (E0l>Eth)&(imin>1)&(index>1)

    imin = imin - 1;

    E0l = ss_E(imin);

end % while E0l > Eth

f_low = (min(index,imin)-1) * df;   % Low Frequency

% end of iterative algorithm

BW = f_high - f_low;            % Signal Frequency Bandwidth

fprintf('\nFrequency Bandwidth = %f [Hz]\nHigh Frequency = %f [Hz]\nLow Frequency =  %f [Hz]\n',BW,f_high,f_low);

% -----------------------------

% Step Three - Graphical output

% -----------------------------

figure(2)

frequency=linspace(0,fs/2,length(ss_E));

PF=plot(frequency,ss_E);

set(PF,'LineWidth',[2]);

L1=line([f_high f_high],[min(ss_E) max(ss_E)]);

set(L1,'Color',[0 0 0],'LineStyle',':')

L1=line([f_low f_low],[min(ss_E) max(ss_E)]);

set(L1,'Color',[0 0 0],'LineStyle',':')

L1=line([f_low f_high],[Eth Eth]);

set(L1,'LineWidth',[2],'Color','red','LineStyle',':')

axis([0.8*f_low 1.2*f_high -0.1*Epeak 1.2*Epeak]);

AX = gca;

set(AX,'FontSize',12);

T=title('Frequency domain');

set(T,'FontSize',14);

X=xlabel('Frequency [Hz]');

set(X,'FontSize',14);

Y=ylabel('Single-Sided ESD  [V^2s/Hz]');

set(Y,'FontSize',14);

3 仿真结果

Matlab生成宽带信号_ide

4 参考文献

[1]梁振楠. 宽带雷达间歇采样转发干扰空域自适应抑制算法研究. Diss. 北京理工大学.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

Matlab生成宽带信号_ide_02