Clear Filters
Clear Filters

I am getting this error despite having signal processing tool downloaded. very limited coding / matlab knowledge so any guidance appreciated!!

8 views (last 30 days)
Error using butter
Expected Wn to be finite.
Error in butter>butterImpl (line 81)
validateattributes(Wn,{'numeric'},{'vector','real','finite','nonempty'},'butter','Wn');
Error in butter (line 59)
[varargout{1:nargout}] = butterImpl(n,Wn,varargin{:});
Error in Kinetisense_Validation_2 (line 344)
[D1 D2] = butter(order_D, fc_D/(Fs/2), 'low'); %Low pass filter for D with 1st order

Answers (1)

Zuber
Zuber on 12 Apr 2023
Hi,
I understand that you are getting an error,
Error using butter.
Expected Wn to be finite.
As per the error message, the input argument 'Wn' of the butter function needs to be finite while it is not. Specifically, there is an error in the code line where ‘butter’ function with arguments (order_D, fc_D/(Fs/2), 'low') is called.
The general syntax of ‘butter’ function is as follows:
[b,a] = butter(n,Wn,ftype)
where
  • n: Filter Order,
  • Wn: Cutoff Frequency
  • ftype : Filter Type.
It is used to design a lowpass, highpass, bandpass, or bandstop Butterworth filter, depending on the value of ftype’.
There are certain checks you can do to rectify the issue:-
  • Ensure that ‘order_D’, ‘fc_D’ and ‘Fs’ are well defined. 'order_D’ should be a positive integer while ‘fc_D’ and ‘Fs’ need to be positive real numbers.
  • Check that the value of fc_D/(Fs/2) is finite. If Fs/2 is zero or fc_D is not specified properly, the resulting value may be NaN or Inf which could cause the ‘butter’ function to throw an error.
For any further information on ‘butter’ function, please refer to the documentation www.mathworks.com/help/signal/ref/butter.html
I hope it helps.

Categories

Find more on Robust Control Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!