Effacer les filtres
Effacer les filtres

problem with 'Filter function' while filtering data, acquired from NI DAQ Board

1 vue (au cours des 30 derniers jours)
Shailendra
Shailendra le 13 Fév 2014
I am trying to filter the sampled square wave output from the DAQ,coming from amplifier. Input frequency is 5.2 Hz. so i had set the cut off frequency to 5.5 hz. and filter order of 100.
when i execute the below matlab code, i am getting error " Error using fdesign.abstracttype/window (line 12) Frequency specifications must be between 0 and 1.
Error in fdesign.abstracttype/superdesign (line 126) Hd = feval(method, this, varargin{:},sysObjArgsDesign{:});
Error in fdesign.abstracttype/design (line 11) varargout{1} = superdesign(this, varargin{:});
Error in filter_daq (line 25) Hd1 = design(Hf,'window','window',@hamming,'SystemObject',true); "
what could be the reason for this error. It would be of great help if let me know the reason. Here is my code for the same.
i
p.TriggerTimeout = 2; %If there is no trigger signal after 2 seconds time out
p.no_of_measurements = 50;
p.InputRange = [-2 2]; %Amplifier output DAQ AI options [-10 10], [-5 5], [-2 2],[-1 1],[-500 500], [-200 200], [-100 100]
p.AInputChannel = 0;
p.Frequency = 5; %in kHz
p.noise = 0.065;
p.no_of_measurementRuns = 6;
ai = analoginput ('nidaq','Dev1');
ch = addchannel(ai,p.AInputChannel,{'PD'}); %Connect the amplifier output to AI0(+) and AI0(-) NRSE
duration = 10;
set(ai,'SampleRate',20000)
ActualRate = get(ai,'SampleRate');
set(ai,'SamplesPerTrigger',duration*ActualRate)
set(ai,'TriggerType','Manual')
blocksize = get(ai,'SamplesPerTrigger');
Fs = ActualRate;
ch.InputRange = p.InputRange;
start (ai);
trigger(ai)
wait(ai,duration + 1)
[data, time] = getdata (ai);
Fc = 5.5;
N = 100; % FIR filter order
Hf = fdesign.lowpass('N,Fc',N,Fc);
Hd1 = design(Hf,'window','window',@hamming,'SystemObject',true);
%Hd2 = design(Hf,'window','window',{@chebwin,50},'SystemObject',true);
hfvt = fvtool(Hd1,Hd2,'Color','White');
legend(hfvt,'Hamming window design','Dolph-Chebyshev window design')
y = filter (Hd1,data);
plot (time, y);

Réponses (0)

Catégories

En savoir plus sur PHY Components dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by