Reply by vishisht83 August 31, 20042004-08-31
I had a real digital signal with digital frequency f1=1/5.Changed
the sample rate by a factor of 5/8 through a combination of
filtering,decimation and interpolation.

Then I plotted the power spectrum of the original signal and then
the changed signal.The signal seemd to have been attenuated (apart
from the effects of interpolation,decimation i had expected) why?

Here is my code: amp = 1; %The amplitude
numSam = 64; %Number of samples
freq = 1; %Frequency
Fs = 5; %Sampling frequency
Ts =1/Fs;
t = (0:Ts:(numSam-1)*Ts);

%Getting the cos wave
cosine = amp*cos(2*pi*freq*t);

%Getting the fourier transform of the signal and calculating
%the power spectrum.
fourier = fft(cosine);
PowerSpectrum = (abs(fourier)).^2;

%Converting the power spectrum to dB.
PowerSpectrum_DB = 10.*log10(PowerSpectrum);
Fd = (0:(numSam-1))/numSam; %Getting the digital frequency
Fd1 = (0:(numSam*5/8-1))/(numSam*5/8);

resampledSignal = resample(cosine,5,8);
resampledSignal_fft = fft(resampledSignal);
resampledSignal_Power = (abs(resampledSignal_fft)).^2;
resampledSignal_Power_dB = 10.*log10(resampledSignal_Power);
figure(1)
subplot(2,1,1);

stem(Fd(1:(numSam)/2),PowerSpectrum_DB(1:((numSam)/2)),'b') grid on;
xlabel('Digital Frequency');
ylabel('Power Spectrum ');
title('\bfPower Spectrum Vs Digital Frequency');
subplot(2,1,2)
resampledSignal = resample(cosine,5,8);
resampledSignal_fft = fft(resampledSignal);
resampledSignal_Power = (abs(resampledSignal_fft)).^2;
resampledSignal_Power_dB = 10.*log10(resampledSignal_Power);
stem(Fd1(1:(numSam)/2),resampledSignal_Power_dB(1:((numSam)/2)),'r')
grid on;