MATLAB: How to do signal processing for discrete set of data

MATLABsignal processing

I've a amplitude-time signal data with 10000 data points having a sampling period of 0.5 microseconds. It has noise embedded in it. I want to remove the noise and do signal averaging. I'm completely new to signal processing and matlab. I've no idea which filter to use also. Can somebody help me with it?

Best Answer

The data you provided only has 256 data points. It does not have much noise, and no significant baseline drift, so I used a lowpass FIR filter here.
This works:
[d,s,r] = xlsread('Athira Surendran data.xls');
Ts = 0.5; % Sampling Interval (s)
Fs = 1/Ts; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
sig = d(1,:); % Signal
t = d(3,:); % Time
L = length(t);
figure(1)
plot(t, sig)
grid
xlabel('Time')
ylabel('Amplitude')
FTsig = fft(sig)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:length(Fv);
figure(2)
plot(Fv, abs(FTsig(Iv))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
fcuts = [0.08 0.19]; % Frequency Vector
mags = [1 0]; % Magnitude (Defines Passbands & Stopbands)
devs = [0.01 0.05]; % Allowable Deviations
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,Fs); % Kaiser Window
n = n + rem(n,2);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale'); % Desing FIR Lowpass Filter
figure(3)
freqz(hh, 1, 2^14, Fs) % Plot Filter Characteristic
filt_sig = filtfilt(hh, 1, sig); % Filter Signal
figure(4)
plot(t, sig, ':b', 'LineWidth',1.5)
hold on
plot(t, filt_sig, '-r')
hold off
grid
legend('Original', 'Low-Pass Filtered')
xlabel('Time')
ylabel('Amplitude')