基于Matlab的脑电波信号处理.docx

上传人:牧羊曲112 文档编号:3384877 上传时间:2023-03-12 格式:DOCX 页数:6 大小:37.36KB
返回 下载 相关 举报
基于Matlab的脑电波信号处理.docx_第1页
第1页 / 共6页
基于Matlab的脑电波信号处理.docx_第2页
第2页 / 共6页
基于Matlab的脑电波信号处理.docx_第3页
第3页 / 共6页
基于Matlab的脑电波信号处理.docx_第4页
第4页 / 共6页
基于Matlab的脑电波信号处理.docx_第5页
第5页 / 共6页
亲,该文档总共6页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《基于Matlab的脑电波信号处理.docx》由会员分享,可在线阅读,更多相关《基于Matlab的脑电波信号处理.docx(6页珍藏版)》请在三一办公上搜索。

1、基于Matlab的脑电波信号处理做脑电波信号处理滴嘿嘿。Matlab addicted Codes %FEATURE EXTRACTER function features = EEGfeaturetrainmod(filename,m) a = 4; b = 7; d = 12; e = 30; signals = 0; for index = 1:9; % read in the first ten EEG data because the files are numbered as ha11test01 rather than ha11test1. s = filename 0 num2

2、str(index) .dat; signal = tread_wfdb(s); if signals = 0; signals = signal; else signals = signals signal; end end for index = 10:1:m/2; % read in the rest of the EEG training data s = filename num2str(index) .dat; signal = tread_wfdb(s); if signals = 0; signals = signal; else signals = signals signa

3、l; end end % modification just for varying the training testing ratio - for index = 25:1:25+m/2; % read in the rest of the EEG training data s = filename num2str(index) .dat; signal = tread_wfdb(s); if signals = 0; signals = signal; else signals = signals signal; end end %end of modification just fo

4、r varying the training testing ratio- for l = 1:m % exrating features (power of each kind of EEG wave forms) Pxx,f=pwelch(signals(:,l)-mean(signals(:,l), , , , 200); % relative power fdelta(l) = sum(Pxx(find(fa); ftheta(l) = sum(Pxx(find(fa); falpha(l) = sum(Pxx(find(fb); fbeta(l) = sum(Pxx(find(fd)

5、; fgama(l)= sum(Pxx(find(fe); % gama wave included for additional work end features = fdelta; ftheta; falpha; fbeta a; fgama; features = features; end %CLASSIFIER %(Has three similar classification modifation: EEGclassification, EEGclassificationmod and EEGclassificationmod1 saved and used in the ru

6、nning file for additional works) function class, err, classall, errall= EEGclassification(trainfilename, m, testfilename,n, p,q) % p - waveform 1, q - wave form two o wave form three % 1 - delta 2 - theta 3 - alpha 4 beta 5 - Gamma featurestrain = EEGfeature(trainfilename, m); % modification to EEGf

7、eaturemod function for varying testing training ratio featurestest = EEGfeature(testfilename,n); training = featurestrain(:,p) featurestrain(:,q); % modify how many features to extract here sample = featurestest(:,p) featurestest(:,q); group = ones(m/2,1);2*ones(m/2,1); traininga = featurestrain; sa

8、mplea = featurestest; class, err, POSTERIOR, logp, coeff= classify(sample, quadratic); %mahalanobis,quadratic,linearas default classall, errall= classify(samplea, traininga, group, quadratic); display(class); display(err); % running file %- using 2 features out of 4 comparison - class = 0; err = 0;

9、p = 1; for q = 2:1:4 clas, er= EEGclassification(ha11train,50,ha11test, 10, p,q); if class = 0; % appending newly generated classificaton and error class = clas; else class = class clas; end if err =0; err = er; else err = err er; training, group, end end p = 2; for q = 3:4 clas, er= EEGclassificati

10、on(ha11train,50,ha11test,10, p,q); class = class clas;err = err er; % appending newly generated classificaton and error end p=3;q=4; clas, er,classall, errall= EEGclassification(ha11train,50,ha11test, 10, p,q); class = class clas classall;err = err er errall; results = class;err; % displaying the results in a table display (results); %- using 2 features out of 5 .

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号