Bug in Cross-Sampen for Matlab
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 82
- Forks
- 21
- Avg merge
- 35m
- Merged PRs (30d)
- 1
Description
The reference at the top of the function mentions that sflag enables standardizing of the two signals via the snippet below. But this code does nothing to normalize the two signals, and I believe it is the y=y/sx that is to blame. I would think it should be x=x/sx instead, unless I'm mistaken.
if sflag>0
y=y-mean(y);
sy=sqrt(mean(y.^2));
y=y/sy;
x=x-mean(x);
sx=sqrt(mean(x.^2));
y=y/sx;
end
before the code, two example sets plot like this:

after the code:

with y=y/sx changed to x=x/sx:

This indicates to me that it is indeed an error.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the Cross-Sampen function and read the sflag normalization block shown in the issue. Reproduce the two example plots, verify that both signals are centered and standardized, and consider the issue done when the corrected branch produces the expected normalized result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matlab
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100