MATLAB: Is the Linear Discriminant Analysis ineffective

eegmotor_imagerysignal processing

I have 378 samples with 513 features each, they're the power spectrum densities of the frequencies calculated using pwelch() for a 1 sec window of motor imagery. I am trying to classify Right hand from Left hand using Linear Discriminant Analysis to reduce the 513 features down to 2.
My results are very poor, barely no separation distinguishing left and right. I am trying to replicate the methodology from a paper:
What am I doing wrong?
What could lead to my data looking like this? I have attached the paper detailing the approach and what I am trying to achieve, our data is essentially the same except I didn't take it with overlapping windows.

Best Answer

I understand that you are trying to use LDA for dimensionality reduction. You can use the fitcdiscr function to apply LDA on a dataset. This will avoid any bugs/issues in manually coding it, or alternately, you can use it as a reference to find issues in your code. Also, you can use any of the other dimensionality reduction techniques available in MATLAB.