Differentiating a signal using diff in MATLAB

조회 수: 10 (최근 30일)
S TOUSIF
S TOUSIF 2017년 8월 4일
편집: Jan 2017년 8월 4일
Hello, I have differentiated an array of signal using diff command of MATLAB but have a confusion in the result. My input signal is a sinusoidal signal and the differentiated signal is also expected to be sinusoidal. I am getting a sinusoidal signal after differentiating the original. However, the signal is not centered at the origin but is shifted in one side. That is, lets say instead of having amplitudes of 5 and -5, it is like 5.5 and -4.5.
Can you give me some reason why it may be happening? I have attached the file containing the data and also an image of what is happening.
<<
>> The image is after differentiating the signal. The code is: current = diff(x(:,1))/(1/1e5);

답변 (1개)

Jan
Jan 2017년 8월 4일
편집: Jan 2017년 8월 4일
The result is exact and correct. You can trust the diff command. Obviously the signal has a sepcific drift, such that the derivative is has not an average of 0:
plot(x(:,1))
Why do you expect that diff replies a signal with average of 0. Obviously only this expectation is the problem.

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by