Scale a before and after signal

조회 수: 8 (최근 30일)
Vinci
Vinci 2018년 8월 2일
댓글: Vinci 2018년 8월 2일
I've recorded some audio using audiorecorder and I want to measure the SNR of a signal I have performed some quantizing operations on. I have the the before and after signal, but how do I scale or normalise(?) the two signals so I am comparing apples with apples. MATLAB noob here btw.

채택된 답변

Surbhi Pillai
Surbhi Pillai 2018년 8월 2일
Hello,
I understand you are trying to normalize the signals two signals to bring them to same scale for comparison. You can try 'min-max normalization' to normalize both the signals to the range [0,1].
Hereby is an example code in MATLAB R2018a for your reference:
t=linspace(0,2*pi,100);
y=5*sin(t);
step_size=10/20;
partition=-2*pi:step:2*pi;
y_Quant=quantiz(y,p);
norm_y=(y-min(y))/(max(y)-min(y)); %%min-max normalization
norm_yQuant=(yQuant-min(yQuant))/(max(yQuant)-min(yQuant));
figure;
subplot(211);
plot(norm_y);
subplot(212);
plot(norm_yQuant)
Both the signals before and after quantization are normalized to same scale for comparison.
Hope this helps...
  댓글 수: 1
Vinci
Vinci 2018년 8월 2일
Thanks Surbhi, that's what I was looking for. I wasn't able to use the quantiz() function as I'm using R2016a, but the two min-max normalization lines below it was what I was after.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by