MATLAB Answers

Error in filtering data

14 views (last 30 days)
Trishneeta Bhattacharya
Trishneeta Bhattacharya on 26 Mar 2020 at 13:15
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?

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.