MATLAB: I plotted the recorded signal using fftshift and got two symmetric spectrums in Matlab. How to display half of the frequency spectrum result? Thanks

dftfftMATLAB

I plotted my recoded signals and got two symmetric spectrums and will like to use halve of it.
What can I do to achieve this?
dt = T_ADE(2,1)-T_ADE(1,1);
[N, M] = size(T_ADE);
fmax = 1/(2*dt);
for n =1:N
t(n)=(n-1)*dt;
f(n)=-fmax + (n-1)*df;
end
x1 = fftshift(T_ADE(:,2)); % swaps the left and right halves
X = fft(x1); X1=fftshift(X);
%Sf = fftshift(fft(T_ADE(:,2)*dt)); % Apply FFT Swap the left and right halves
figure(2)
plot(f/1e9,abs(X1), 'b', 'Linewidth',2);
xlabel('Frequency[GHz]'); ylabel('Signal Amplitude [dB]');
title('Frequency Response of the Transmitted Wave');

Best Answer

I do not have your data, so I am using only the information that you provided.
This is how I would do it:
dt = T_ADE(2,1)-T_ADE(1,1); % Sampling Interval (Assuming Regular Sampling)
Fs = 1/dt; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
L = size(T_ADE,1); % Number Of Observations
ADE2_mean = mean(T_ADE(:,2)); % Calculate D-C Offset
FT_ADE2 = fft(T_ADE(:,2) - ADE2_mean)/L; % Length-Scaled Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Corresponding Index Vector
figure(2)
plot(Fv, abs(FT_ADE2(Iv))*2)
grid
xlabel('Frequency (Cycles/Time Unit)')
ylabel('Amplitude (Units)')
I obviously cannot test this without your data. However this sort of approach has worked numerous times in the past, and likely will work here with your data as well.