Example Matlab Files for HW4
Problems 3 and 4
%%%two tone test simulation
t=2*pi*[1:256]/256;
A=0;
%%% A is input power in dBm
%%% We assume the input tones are separated by
%%%
f2f1=2 ; then (f1f2)/2=1 is modulation frequency
w=2*cos(t);
z=20*log10(abs(w))+A;
%%% z is the input envelope, in dBm
%%% We assume that there are functions gain1(x) and phase1(x)
%%%
that compute the gain and phase for a given
%%%
input, expressed in dBm
for i=1:256
y(i)=w(i)*10^((A+gain1(z(i)))/20)*exp(j*phase1(z(i))*2*pi/360);
end
yfft=2*fft(y(1:256))/256;
pyf=20*log10(abs(yfft));
plot(pyf(1:64));
'P1='
pyf(2)
%%% this is the fundamental output in dBm
'IM3='
pyf(4)pyf(2)
%%% this is the 3rd order intermod in dBc relative to P1
'IM5='
pyf(6)pyf(2)
%%% this is the 5th order intermod in dBc relative to P1
end
%% examples of table based functions
function y=gain2(x)
%%% table based amplifier gain function
%%% expresses gain in dB as function of input in dBm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
z=x;
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 '09
 Frequency, Finite impulse response, fir filter, frequency axis vector, tone test simulation

Click to edit the document details