You are on page 1of 1

a=[-3 -1 1 3]%symbo constelation

ind=randint(100,1,2)
ind=ind+1;
pam=a(ind);
figure(1)
plot(pam)
Fs=24000;
T=1/8000;
t=-5*T:1/Fs:5*T
t=t+1e-10
alpha=.5;
p = (sin(pi*t/T)./(pi*t/T)).*(cos(alfa*pi*t/T)./(1-(2*alfa*t/T).^2));
figure(2)
plot(t,p)
hold on
stem(t,p)
N=length(pam)
r=T*Fs;
pams=zeros(size(1:N*r));
pams(1:r:r*N)=pam
xn=filter(p,1,pams)
figure(3)
plot(xn(1:200))
clf
hold on
for(i=1:6:300-6)
plot(xn(i:i+6))
end
hold off
Nfft = 2048; % Size of the FFT
P = fftshift(fft(p,Nfft)); % Spectrum (FFT) of the pulse-shape
X = fftshift(fft(xn,Nfft)); % Spectrum (FFT) of the PAM waveform
Y = fftshift(fft(yn,Nfft)); % Spectrum (FFT) of the noisy PAM waveform
f = -Fs/2:Fs/Nfft:Fs/2-Fs/Nfft;
figure(4)
subplot(211)
f=-Fs/2:Fs/Nfft:Fs/2-Fs/Nfft;
plot(f,P)
subplot(212)
plot(f,20*log(abs(P)))

You might also like