{"id":15716250,"url":"https://github.com/zazi2002/eeg-processing-erp-ssvep","last_synced_at":"2025-03-30T20:44:18.298Z","repository":{"id":256071915,"uuid":"854259870","full_name":"ZaZi2002/EEG-Processing-ERP-SSVEP","owner":"ZaZi2002","description":"EEG Signal Processing project, which involves analyzing EEG signals for both ERP and SSVEP.","archived":false,"fork":false,"pushed_at":"2024-09-09T14:43:24.000Z","size":17940,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T20:44:11.316Z","etag":null,"topics":["csp","eeg","erp","matlab","signal-processing","ssvep"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZaZi2002.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-08T19:42:53.000Z","updated_at":"2024-09-09T14:43:28.000Z","dependencies_parsed_at":"2024-09-09T17:59:51.269Z","dependency_job_id":null,"html_url":"https://github.com/ZaZi2002/EEG-Processing-ERP-SSVEP","commit_stats":null,"previous_names":["zazi2002/eeg-processing-chw4","zazi2002/eeg-processing-erp-ssvep"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZaZi2002%2FEEG-Processing-ERP-SSVEP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZaZi2002%2FEEG-Processing-ERP-SSVEP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZaZi2002%2FEEG-Processing-ERP-SSVEP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZaZi2002%2FEEG-Processing-ERP-SSVEP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZaZi2002","download_url":"https://codeload.github.com/ZaZi2002/EEG-Processing-ERP-SSVEP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246379377,"owners_count":20767694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csp","eeg","erp","matlab","signal-processing","ssvep"],"created_at":"2024-10-03T21:44:43.008Z","updated_at":"2025-03-30T20:44:18.271Z","avatar_url":"https://github.com/ZaZi2002.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EEG Signal Processing Fourth Project\n\n## Overview\n\nThis project involves analyzing EEG signals for both event-related potentials (ERPs) and steady-state visual evoked potentials (SSVEPs) using various techniques including averaging, frequency content analysis, Canonical Correlation Analysis (CCA), and Common Spatial Pattern (CSP) methods.\n\n## 1. ERP Signal Analysis\n\n### Data\n- **File**: `mat.ERP_EEG`\n- **Description**: EEG from channel Pz, with 2550 trials, recorded at 240 Hz. The data includes brain response to visual stimulation with 300P potentials.\n\n### Tasks\n\n- **a)** For varying numbers of trials (`100:100:2500`), plot the average response. Compare the plots in one figure, ordered by increasing number of trials.\n- **b)** Plot the maximum absolute amplitude of the signal versus the number of averaged trials.\n- **c)** Plot the root mean square (RMS) error between the 𝑛-th and the (𝑛-1)-th average patterns as a function of the number of averaged trials (`1:2550`).\n- **d)** Determine the minimum number of trials needed to extract the 300P response effectively based on results from parts (a), (b), and (c).\n- **e)** Compare the average response from part (d) with responses averaged over:\n  - 2550 trials\n  - 𝑛 trials (where 𝑛 is the number obtained from part (d))\n  - Randomly selected subsets of 2550 responses with 𝑛 trials\n  - Random subsets with different 𝑛 values\n- **f)** Investigate real-world studies using 300P patterns. Compare the number of repetitions used in practical studies with the results obtained in previous sections. Discuss any discrepancies.\n\n## 2. SSVEP Signal Analysis\n\n### Data\n- **File**: `mat.SSVEP`\n- **Description**: Contains SSVEP signals from a user, including 6 channels of EEG data (`Pz`, `O1`, `O2`, `P7`, `P8`, `Oz`), stimulus frequencies, and sample times.\n\n### Tasks\n\n#### Frequency Content Analysis\n\n- **a)** Preprocess the data:\n  - **a1)** Apply a band-pass filter to remove frequencies below 1 Hz and above 40 Hz.\n  - **a2)** Segment each of the 15 trials into 5-second windows.\n  - **a3)** Calculate and plot the frequency content for each channel using the `pwelch` function.\n  - **a4)** Assess whether all channels show the same frequency content in each trial and explain any differences.\n  - **a5)** Determine the dominant frequency in each trial and discuss the reasons for the observed peaks.\n\n#### Canonical Correlation Analysis (CCA)\n\n- **b)** Perform CCA:\n  - **b1)** Segment each of the 15 trials into 5-second windows.\n  - **b2)** Use CCA to determine dominant frequencies. Implement `canoncorr` and evaluate the classification accuracy.\n  - **b3)** Assess whether reducing the number of channels affects the classification performance.\n  - **b4)** Investigate if reducing the window length affects classification accuracy.\n\n## 3. CSP for Two-Class Classification\n\n### Data\n- **File**: `mat.CSPdata`\n- **Description**: Contains EEG data for mental imagery tasks (e.g., foot movement vs. mental subtraction) with training and test datasets.\n\n### Tasks\n\n- **a)** Obtain spatial filters using CSP with the training data and apply them to the training data. Plot the filtered signals for the first and last filters and compare them.\n- **b)** Plot the spatial filters using `m.plottopomap` and compare them.\n- **c)** Perform 4-fold cross-validation:\n  - Split the training data into 4 subsets, using 3 for training and 1 for validation each time.\n  - Train the CSP algorithm and extract CSP features. Use simple classifiers (e.g., kNN, linear SVM, LDA) to classify the validation data and compute the average accuracy.\n  - Determine the optimal number of CSP filters.\n- **d)** Train the best classifier on the full training set and test it on the test data. Store the predicted labels in `TestLabel`.\n\n### Notes\n\n- **EEG Recording Details**:\n  - **System**: GAMMAsys tec.g\n  - **Electrodes**: 30 channels according to the 10-20 system\n  - **Filtering**: Band-pass filter (0.5-100 Hz), notch filter (50 Hz)\n  - **Sampling Rate**: 256 Hz\n  - **Trial Length**: 1 second (256 time samples)\n  - **Total Trials**: 210\n  - **Training Trials**: 165 (Labels: 1 - foot movement, 0 - mental subtraction)\n  - **Test Trials**: 45\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzazi2002%2Feeg-processing-erp-ssvep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzazi2002%2Feeg-processing-erp-ssvep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzazi2002%2Feeg-processing-erp-ssvep/lists"}