# Calculate difference between two signals

조회 수: 21 (최근 30일)
Nimish Iwale 2019년 7월 17일
답변: Star Strider 2019년 7월 17일
What and how would be the best way to calculate the difference between the 2 signals (A and B) shown below in terms of percentage difference or a factor of comparison?

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

### 답변 (1개)

Star Strider 2019년 7월 17일
I would compare them by noting that the amplitudes of the peaks vary with respect to the independent variable, similarly for both ‘A’ and ‘B’. One way would be to do a simple linear regression of one against the other:
P = [A(:) ones(size(A(:)))] \ B(:) % P(1) = Slope, P(2) = Intercept
another would be to regress both of them with respect to the independent variable (assumed here to be ‘x’):
Pa = [x(:) ones(size(x(:)))] \ A(:) % Pa(1) = Slope, Pa(2) = Intercept
Pb = [x(:) ones(size(x(:)))] \ B(:) % Pb(1) = Slope, Pb(2) = Intercept
A direct point-by-point difference or a single statistic (for example mean of the difference between them) would not capture their both changing over the independent variable at different rates, and with respect to each other.

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

### 카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by