Why does rref() make a sound sample sound different?
조회 수: 1 (최근 30일)
이전 댓글 표시
I was messing around the other day and ended up with the following code:
load handel
h = [y;Fs];
h = h';
d = rref(h);
sound(d)
What does rref() do to make it sound like that?
댓글 수: 0
채택된 답변
Star Strider
2016년 5월 3일
It depends on how you give rref the matrix. (Stereo sound files are (Nx2) matrices.)
If you give it as the two-column matrix, you get the result that John describes. If you transpose the matrix (to (2xN), you get an entirely different result.
Experiment:
t = linspace(0, 2)';
M = [sin(2*pi*t) cos(2*pi*t)]; % Create Data
figure(1)
subplot(2,1,1)
plot(t, M)
hold on
plot(t, rref(M), '--')
hold off
grid
subplot(2,1,2)
plot(t, M)
hold on
plot(t, rref(M'), '--')
hold off
grid
댓글 수: 0
추가 답변 (1개)
John D'Errico
2016년 5월 3일
Why in the name of god and little green apples would you bother to do this? rref is a linear algebra tool, normally applied to matrices, for a specific purpose. Throwing random numbers into a random function will yield randomly meaningless (and useless) results.
d is a column vector as you create it. rref will take ANY column vector with at least one non-zero element, and return a vector which is entirely zero, except that the first element is 1.
When you then put that into the sound function, it sounds as it does.
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!