Signal Processing in MATLAB
MATLAB provides a range of tools for signal processing, including signal filtering, Fourier analysis, and wavelet analysis. Here's an example of how to filter a noisy signal using a low-pass filter:
load('ecg.mat'); % load the ECG signal
fs = 360; % set the sampling frequency
t = (0:length(ecg)-1)/fs; % create a time vector
subplot(2,1,1);
plot(t,ecg); % plot the original signal
xlabel('Time (s)'); ylabel('ECG (mV)');
title('Original Signal');
subplot(2,1,2);
fc = 40; % set the cutoff frequency
[b,a] = butter(2,fc/(fs/2)); % design a low-pass Butterworth filter
ecg_filt = filter(b,a,ecg); % apply the filter to the signal
plot(t,ecg_filt); % plot the filtered signal
xlabel('Time (s)'); ylabel('ECG (mV)');
title('Filtered Signal');
No comments:
Post a Comment