Hi Please i have problem in my assignment in Digital signal
Hi,
Please i have problem in my assignment in Digital signal processing in MATLAB, so can anyone help me with it ASAP?
Firstly, we have given a data file that has the EEG signal of a patient.our task is to find the seizure part from the given signal. After detecting the seizure, we have to plot a pulse signal on the given signal, pulse of 1 on the seizure part, and 0 everywhere else.
What we did is that we cut the seizure part from the original signal ( we have given where the seizure starts and ends, but we can\'t used in the implementation, because we will use our code for different patients, and the time for them is different), then we measured different features such as mean, frequency. then we do a model (we used a sine wave) that has the same features as the seizure. We used correlation between the original signal and the model and see where are the highest values, which will be the seizure part. our problem is that we can\'t detect where exactly the seizure starts and where it ends. there were many high values even in the normal part. is our approach correct? what we have to do to make it work?
And this our code so far..please check it
clear all;
close all;
clc;
load chb01_04;
fs=256;
[r c]=size(record)%number of samples
p=record(14,:); %draw row of 14
figure(1)
plot(p); %% Original Signal
T=n/fs
n=c/T %nummber of samples per second
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%[1] Getting Seizure part only
start=1467*n %start of the seizure
ended=1494*n %end of the seizure
seizure=p(start:ended);
figure(2),plot(seizure); %seizure signal
title(\'seizure signal\');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%[2] Getting Normal part only
startN=start-1;
normal=record(14,1:startN);
figure(3)
plot(normal); %seizure signal
title(\'normal signal\');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [3] find mean of seizure signal
meanS=mean(abs(seizure));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [4] find mean of normal signal
meanN=mean(abs(normal));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%[5] taking their frequency values
my_fft(seizure, fs, length(seizure));
my_fft(normal, fs, length(normal));
freS=1.25;
freN=[ 17, 32, 48];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%[6]Generating model signal
T=5;
dt=1/fs;
t=0:dt:T-dt;
model= meanS*sin(2*pi*freS*t);
figure(1)
plot(t,model);
my_fft(model, fs, length(model));
meanM=mean(abs(model));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%[7] correlate model and the original signal to detect the seizure
y=xcorr(model,p);
k=length(p); % length of the given signal
max=0;
for i=1:(k) % just for see where the highest value
if(max<y(i))
max=y(i);
maxind=i;
end
end
Solution
Hello,
Firstly, we have given a data file that has the EEG signal of a patient.our task is to find the seizure part from the given signal. After detecting the seizure, we have to plot a pulse signal on the given signal, pulse of 1 on the seizure part, and 0 everywhere else.
As per my perspective, The method you were following is not correct, why because your aim is to detect the seizure part of EEG signal.
For that you made a model signal out of seizure part and normal part. Then correlating the EEG signal with model signal. If you do like this, If EEG signal don\'t has the seizure part, your MeanS, freS parameters will appear in the output correlated signal.
Method of Idea:
1. Take the fft of seizure part of EEG signal and normal part of EEG signal, Identify the differences in frequency and amplitude.
2. Now, take the EEG signal from a patient, apply fft to it. Find the frequency and amplitude components relate to the seizure part .
3. Then generate a pulse signal at seizure frequencies as logic 1 and normal frequencies as logic 0.
You didn\'t post the EEG signal, otherwise i can give the matlab code for you. If any further information post me again.


