Извлечение данных сигнала ВСР из файла

y=importdata (filename, ”);y=strrep (у, ’O’);y=strrep (у, ’,’, ’); data=cell2mat (cellfun (@str2num, y,’Uniform Output’,...

false)); check=dijf (data (:, 1)); sC=size (check); N=1; L (N)=O;

for i=l: sC (1) if check (i)<0

N=N+1; L (N)=i;

end; end;

L (N+l)=sC(1)+1; l=diff(L); TRR=cell (N, 1);

for i=l: N

x= zeros (I (i),2); forj=l: I (i)

x (j, l)=data (j+L (i), 1);x (j,2)=data (j+L (i),2);

end; TRR{i,l}=x; end;

% разбиение сигнала на этапы

ifi==l

TRR_temp=TRR; clear TRR

Tl=300000; T2=900000;

TRR{l,l}=TRR_temp{l,l} (TRR_temp{l,l} (:,1)

TRR{2, l}=TRR_temp{l, 1} (TRR_temp{l, 1} (:, 1)>...

T1& TRR_temp{l, 1} (:, 1)

TRR{2,1} (:,1)=TRR{2,1) (:,1)-TRR{2,1} (1,1);

TRR{3, l}=TRR_temp{l, 1} (TRR_temp{l, 1} (:, 1) >T2,:);

TRR{3,1} (:,1)=TRR{3,1) (:,1)-TRR{3,1) (1,1); end;

Очищение сигнала от артефактов

М=теап (Х(:,2));

sko=std(X(:,2));

index = 1;

forj=l: length (X);

ifX(j,2) + 5* sko &&X(j,2)>M- 3* sko

NN (index,2)=X (j,2);

if index == 1

NN (index,1)=O;

else

NN (index, 1)=NN (index-1,1)+NN (index-1,2);

end;

index = index + 1;

end;

end;

Фурье-анализ сигналов ВСР

T1=NN(1,1); T2=NN(end, 1); signal (:, 1)= (ТІ: 100: T2); signal (:,2)=interpl (NN (:, 1), NN (:,2), signal (:, 1), ’spline’); st=size (signal);

l=2^nextpow2 (st (1));

furie=jft (detrend (signal (:,2)), I);

Fs=l/0.1;

f= Fs/2*linspace (0,1,1/2+1);

HF= sum ((abs (furie (f>0.15&f<0.4)). *2))/l;

LF= sum ((abs (furie (f>0.04&f<0.15)). ^2))/l;

VLF= sum ((abs (furie (f>0.003&f<0.04)). л2))/1;

TP=HF+LF+VLF;

figure;

plot(f(f>0.003&f<0.4),...

(abs (furie (f>0.003&f<0.4)). *2)/l);

title (strcat (‘HFn:’, num2str (round (100*HF/TP)), ...

(%, LFn:’, num2str (round (100*LF/TP)),...

‘%, VLFn:’, num2str (round (100*VLF/TP)),’%’));

Вейвлет-анализ сигналов ВСР

T1=NN (1,1); T2=NN (end, 1); signal (:, 1)= (ТІ: 100: T2);

signal (:,2)=interpl (NN (:, 1), NN (:,2), signal (:, 1),’spline’);

fl=0.4; f2=0.15; f3=0.04;f4=0.003;

D=0.1; w=’morl’; fc=centfrq (w);

al= (fc)/(D* (f4)); a4= (fc)/(D* (fl));

lnal=log(al); lna4=log(a4);

lna=linspace (Inal, lna4,300);

A=exp (Ina); F=fc./(D. *A); dA=zeros (size (A));

for і =2: length (A)-1

dA (i)=A (i+l)-A (i-1);

end;

dA (1)=2* (A (2)-A (1)); dA (end)=2* (A (end)-A (end-1)); dA=abs (dA);

JV=cwt (detrend (signal (:,2)), A, w); sW=size (If);

forj=l:sW(2)

shf(:,j)=W(F>f2&Ff2&F

./(A(F>f2&F

slf(:,j)=W(F>f3&Fk(dA (F>f3&F

./(A(F>f3&F

svlf(:,j)=W(F>f4&Ff4&F

./(A (F>f4&FA (3/2));

end;

cnorm=max (abs ((detrend (signal (:,2)))))...

/max (abs (sum (shf)+sum (slf)+sum (svlf)));

u_hf=sum (cnorm*shf). л2; u_lf=sum (cnorm*slf). л2;

u_vlf=sum (cnorm*svlf). л2;

u_tp =ujhf+u_lf+u_vlf;

HF=sum (u_hf); LF=sum (u_lf); VLF=sum (u_vlf);

TP=sum (u_tp);

lfkhf=zeros (1, sW(2));

Ifkhf (1)=O;

fori=2:sW(2)

if u_hf (i) >0.0 Ртах (u_hf)

Ifkhf (i)=u_lf (i)/u_hf (i);

else

Ifkhf (i)=lfkhf (i-1);

end;

end;

Aintense=sum (Ifkhf (lfkhf>10));

figure; plot (signal (:, 1), Ifkhf);

hold on; plot (signal (:,l),10*ones (size (signal (:,1)))) title ('отношение LFк HF’); xlabel ('время, мс’);

 
Посмотреть оригинал
< Пред   СОДЕРЖАНИЕ   ОРИГИНАЛ   След >