📄 7.1.m
字号:
%
% FUNCTION 7.1 : "cp0701_shape_factor_variation"
%
% Effect of shape factor variation on pulse width and
% ESD of the Gaussian pulse
% The pulse amplitude is set to 'A'
% 'smp' samples of the Gaussian pulse are considered in
% the time interval 'Tmax - Tmin'
%
% The function receives as input:
% 1) the minimum value of the shape factor 'alphamin'
% 2) the increase step 'alphastep'
% 3) the number of values to be investigated
% 'N_alphavalues'
%
% The function plots for each value of alpha the waveform
% and corresponding ESD
%
% Programmed by Luca De Nardis
function cp0701_shape_factor_variation(alphamin,...
alphastep, N_alphavalues)
% --------------------------------------------
% Step Zero - Input parameters and initialize
% --------------------------------------------
A=1; % pulse amplitude [V]
smp=1024; % number of samples
Tmin=-4e-9; % lower time interval limit
Tmax=4e-9; % upper time interval limit
alpha=alphamin; % initialization of the shape
% factor
t=linspace(Tmin,Tmax,smp); % initialization of the time
% axis
for i=1:N_alphavalues
% -------------------------------------------
% Step One - Pulse waveform in the time domain
% -------------------------------------------
% pulse waveform definition
pulse=-A*exp(-2*pi*(t/alpha).^2);
% -------------------------------------------
% Step Two - Analysis in the frequency domain
% -------------------------------------------
dt=(Tmax-Tmin)/smp; % sampling period
fs=1/dt % sampling frequency
N=smp; % number of samples (i.e.,
% size of the FFT)
df=1/(N*dt); % fundamental frequency
X=fft(pulse); % double-sided MATLAB
% amplitude spectrum
X=X/N; % conversion from MATLAB
% spectrum to Fourier
% spectrum
E=fftshift(abs(X).^2/(df^2)); % double-sided ESD
Ess=2*E((N/2+1):N); % single-sided ESD
% ---------------------------------
% Step Three - Graphical output
% ---------------------------------
% Time domain representation
figure(1);
PT=plot(t,pulse);
set(PT,'LineWidth',[2]);
AX=gca;
set(AX,'FontSize',12);
T=title('Time domain');
set(T,'FontSize',14);
X=xlabel('Time [s]');
set(X,'FontSize',14);
Y=ylabel('Amplitude [V]');
set(Y,'FontSize',14);
alphabehaviour={'Increasing \alpha'};
text(0.75e-9,-0.5,alphabehaviour,...
'BackgroundColor',[1 1 1]);
axis([-2e-9 2e-9 -1.2 1.2]);
hold on
% frequency domain representation
figure(2);
positivefrequency=linspace(0,(fs/2),N/2);
PF=semilogy(positivefrequency,Ess);
set(PF,'LineWidth',[2]);
AX=gca;
set(AX,'FontSize',12);
T=title('Frequency domain');
set(T,'FontSize',14);
X=xlabel('Frequency [Hz]');
set(X,'FontSize',14);
Y=ylabel('ESD [(V^2)*sec/Hz]');
set(Y,'FontSize',14);
axis([0 20e9 1e-60 1e-10]);
text(7.5e9, 1e-25, alphabehaviour,...
'BackgroundColor',[1 1 1]);
hold on
alpha=alpha+alphastep;% increase of alpha value for
% the next step
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -