fraizer
Newbie level 4
I have tried doing the same for the set of data that I have got but with no use. I have got a data file that contains 2500 points of amplitude against time which I am trying to find the FFT of. Since its a 5MHz signal, I am expecting to see the peak magnitude at around 5MHz, but I am not! Been fiddling around for a couple of weeks now.
data=dlmread('inputm.txt','\t'); % to input the points in the file column 1 being time and column 2 being for the corresponding amplitude.
time=data,1);
vdata=data,2);
X=fft(vdata);
M=abs(X);
f0=5000000; % This is the fundamental frequency.
f=f0*(0:length(X)-1);
figure;
clf;
plot(f(1length(f))),M(1length(M))))
Can anyone help - Basically I have got data which when plot will give a signal - I need to find the FFT of this signal and verify that the peak magnitude is at 5MHz ( although its not expected for it to be exactly at 5 maybe 4.89 or so). Thanks.
Added after 9 minutes:
I have also tried this in order to get the amplitude spectrum:
clear;
clc;
s=importdata('echo1.txt');
z=s.data;
Y=z,2);
y=fft(Y)
figure(1), plot
figure(2),plot(y,'ro')
grid on
xlabel('Real number')
ylabel('Imaginary')
title('FFT of Signal')
n=length
power=abs(y(1:floor(n/2))).^2
nyquist=1/2
freq=((1:n/2)/(n/2)*nyquist)*5000000
figure(3), plot(freq,power)
xlabel('Frequency')
ylabel('Power')
title('Power Spectrum of Signal')
grid on
amp=abs(y(1:floor(n/2)))
figure(4), plot(freq,amp)
xlabel('Frequency')
ylabel('Amplitude')
title('Amplitude Spectrum of Signal')
grid on
Added after 23 seconds:
I have also tried this in order to get the amplitude spectrum:
clear;
clc;
s=importdata('echo1.txt');
z=s.data;
Y=z,2);
y=fft(Y)
figure(1), plot
figure(2),plot(y,'ro')
grid on
xlabel('Real number')
ylabel('Imaginary')
title('FFT of Signal')
n=length
power=abs(y(1:floor(n/2))).^2
nyquist=1/2
freq=((1:n/2)/(n/2)*nyquist)*5000000
figure(3), plot(freq,power)
xlabel('Frequency')
ylabel('Power')
title('Power Spectrum of Signal')
grid on
amp=abs(y(1:floor(n/2)))
figure(4), plot(freq,amp)
xlabel('Frequency')
ylabel('Amplitude')
title('Amplitude Spectrum of Signal')
grid on
data=dlmread('inputm.txt','\t'); % to input the points in the file column 1 being time and column 2 being for the corresponding amplitude.
time=data,1);
vdata=data,2);
X=fft(vdata);
M=abs(X);
f0=5000000; % This is the fundamental frequency.
f=f0*(0:length(X)-1);
figure;
clf;
plot(f(1length(f))),M(1length(M))))
Can anyone help - Basically I have got data which when plot will give a signal - I need to find the FFT of this signal and verify that the peak magnitude is at 5MHz ( although its not expected for it to be exactly at 5 maybe 4.89 or so). Thanks.
Added after 9 minutes:
I have also tried this in order to get the amplitude spectrum:
clear;
clc;
s=importdata('echo1.txt');
z=s.data;
Y=z,2);
y=fft(Y)
figure(1), plot
figure(2),plot(y,'ro')
grid on
xlabel('Real number')
ylabel('Imaginary')
title('FFT of Signal')
n=length
power=abs(y(1:floor(n/2))).^2
nyquist=1/2
freq=((1:n/2)/(n/2)*nyquist)*5000000
figure(3), plot(freq,power)
xlabel('Frequency')
ylabel('Power')
title('Power Spectrum of Signal')
grid on
amp=abs(y(1:floor(n/2)))
figure(4), plot(freq,amp)
xlabel('Frequency')
ylabel('Amplitude')
title('Amplitude Spectrum of Signal')
grid on
Added after 23 seconds:
I have also tried this in order to get the amplitude spectrum:
clear;
clc;
s=importdata('echo1.txt');
z=s.data;
Y=z,2);
y=fft(Y)
figure(1), plot
figure(2),plot(y,'ro')
grid on
xlabel('Real number')
ylabel('Imaginary')
title('FFT of Signal')
n=length
power=abs(y(1:floor(n/2))).^2
nyquist=1/2
freq=((1:n/2)/(n/2)*nyquist)*5000000
figure(3), plot(freq,power)
xlabel('Frequency')
ylabel('Power')
title('Power Spectrum of Signal')
grid on
amp=abs(y(1:floor(n/2)))
figure(4), plot(freq,amp)
xlabel('Frequency')
ylabel('Amplitude')
title('Amplitude Spectrum of Signal')
grid on