I am trying to simulate a distributed sensing system and I need to filter only frequencies lesser than 500 Hz(low pass filter) from acquired signal with sample rate 1250000 Samples/sec using below mentioned program:
%Time specifications:
Fs = 1250000; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 0.25; % seconds
t = (dt:dt:StopTime-dt); % seconds
%Input Sine wave:
Fc = 300; % hertz
dataIn = cos(2*pi*Fc*t);
% Plot the signal versus time:
figure;
plot(t,dataIn);
xlabel('time (in seconds)');
title('Input signal');
zoom xon;
wc=500; % cut off frequency
Wn=wc/(Fs/2); % normalized frequency
[b,a] = butter(6,Wn,'low');
figure;
freqz(b,a)
%Plot filtered output
dataOut = filter(b,a,dataIn);
figure;
plot(t,dataOut)
title('dataout')
zoom xon;
However I am unable to filter the desired frequencies below 500 Hz, as the cut off frequency is dependant on the sampling rate. Kindly suggest what to be done as I am new in MATLAB.
Thanks in advance.