Error in filtering data
Show older comments
I am trying to filter sla data which has 2191 data points (daily data from 2013 to 2018). The code I am using is given below. While I run this code, I am getting an error.
In filtfilt>getCoeffsAndInitialConditions (line 200)
In filtfilt (line 97)
In filter_matlab (line 8)
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.419047e-16.
What is the meaning of it?
My code is:
sla = ncread('sla_ave.nc', 'SLA_AVE');
highcut = (2191/100)/(2191/2); %define highcut frequency 100 days in radians
lowcut =(2191/250)/(2191/2); %define lowcut frequency 250 days in radians
[b,a] = butter(6,[lowcut highcut]); %create 6th order butterworth band pass filter
freqz(b,a); %look at your filter characteristics
FilteredData = filtfilt(b,a,sla); %filter Data without phase shift
t=datenum(datestr(ncread('sla_ave.nc', 'TIME')+datenum(1950,1,1)));
plot(t, sla, 'linewidth', 1.5);
hold on;
plot(t, FilteredData, 'linewidth', 1.5);
axis tight;
xtck=t(1:100:2191);
set(gca,'XTick', xtck);
set(gca,'XTickLabel',datestr(t(1:100:2191),'m-yy'),'FontWeight','bold','FontSize',8);
Also, What is the meaning of defining 100 days in radians. Why is it necessary?
Accepted Answer
More Answers (0)
Categories
Find more on Butterworth in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!