hi, I'm new in using matlab, i was tried to find my motor's frequency by using fft, but i got in trouble, i tried lot of examples on the internet but it didn't work, if somebody can give my some tips i will be so appreciate!!!
my sampling rate is about 8hz, and in txt is the acceleration of motor about 1024,and this code is one of example i copy from internet,even it doesn't works.
c=textread('C:\Users\wkj88\Desktop\11.txt', '%f') ;T=1/250;L=length(c);Fs=1/T;t=(0:L-1)*T;Y = fft(c);mag1 = abs(Y/L);mag = mag1(1:L/2+1);mag(2:end-1) = 2*mag(2:end-1);ph1 = rad2deg(Y/L);ph = ph1(1:L/2+1);ph(2:end-1) = 2*ph(2:end-1);f=Fs*(0:(L/2))/L;subplot(2,2,[1,2])plot(t,c);title('Vibration Signal');xlabel('Time (seconds)');ylabel('Amplitude (voltage)');subplot(2,2,3)plot(f,mag);title('Magnituge Plot');xlabel('Frequency (Hz)');ylabel('Amplitude');subplot(2,2,4)plot(f,ph);title('Phase Plot');xlabel('Frequency (Hz)');ylabel('Phase (degree)');
Best Answer