How can I calculate and plot the spectral power density of Square Root Raised Cosine Pulse using fft?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Konstantinos
am 16 Okt. 2013
Kommentiert: Konstantinos
am 17 Okt. 2013
I was given the following Matlab function which takes 4 parameters as arguments and returns a Square Root Raised Cosine pulse.
function [phi, t] = srrc_pulse(T, Ts, A, a)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% phi = srrc_pulse(T, Ts, A, a) %
% OUTPUT %
% phi: truncated SRRC pulse, with parameter T, %
% roll-off factor a, and duration 2*A*T %
% t: time axis of the truncated pulse %
% INPUT %
% T: Nyquist parameter or symbol period (real number) %
% Ts: sampling period (Ts=T/over) %
% where over is a positive INTEGER called oversampling factor %
% A: half duration of the pulse in symbol periods (positive INTEGER) %
% a: roll-off factor (real number between 0 and 1) %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
t = [-A*T:Ts:A*T] + 10^(-8); % in order to avoid division by zero problems at t=0.
if (a>0 && a<=1)
num = cos((1+a)*pi*t/T) + sin((1-a)*pi*t/T) ./ (4*a*t/T);
denom = 1-(4*a*t./T).^2;
phi = 4*a/(pi*sqrt(T)) * num ./ denom;
elseif (a==0)
phi = 1/(sqrt(T)) * sin(pi*t/T)./(pi*t/T);
else
phi = zeros(length(t),1);
disp('Illegal value of roll-off factor')
return
end
For example let's suppose that T=1, Ts=1/10, A=4 and a=0. So I invoke the method like that:
phi1 = srrc_pulse(1, 1/10, 4, 0)
What I want to do next is to find the Fourier Transform of this pulse at L equally spaced points (for example L=1000) across the frequency axis from -(Fs/2) to Fs/2 where Fs is the sampling frequency, using the fft function and then plot what I get so I can have a visual approach of the spectral power density of the pulse. My problem is that I can see the plot only for the positive values of frequency, and I cannot see the negative ones. I have also attached an image of what I get on the plot. My code is the following. Any help would be greatly appreciated!
%
2 Kommentare
Akzeptierte Antwort
Nishitha Ayyalapu
am 17 Okt. 2013
Bearbeitet: Nishitha Ayyalapu
am 17 Okt. 2013
I edited your inital code to go from single-sided spectrum to two-sided.
Fs = 10; %Sampling frequency
T = 1/Fs; %Symbol period
L = 1000; %Number of points
t = (0:L-1)*T; %Time vector
phi1 = srrc_pulse(1, 1/10, 4, 0); %SRRC pulse
figure
plot(Fs*t(1:50), phi1(1:50));
NFFT = 2^nextpow2(L);
Y = fft(phi1, NFFT)./L;
Y2 = fftshift(fft(phi1, NFFT)./L);
f = Fs/2*linspace(0,1,NFFT/2+1);
f2 = ((0:NFFT-1) -ceil((NFFT-1)/2))/NFFT/T;
figure
plot(f, 2*abs(Y(1:NFFT/2+1))); %one sided
figure
plot(f2, 2*abs(Y2)); %two sided
Weitere Antworten (1)
Nishitha Ayyalapu
am 17 Okt. 2013
However to answer how to get negative frequency axis:
1.) Do fftshit
2.) change frequency axis accordingly.
Below is the link which answered how to do that
0 Kommentare
Siehe auch
Kategorien
Mehr zu Spectral Measurements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!