How to substract/add 2 signals which have different phase?

6 views (last 30 days)
Currently, I want to finding the different of 2 signals in Timedomain. The data is time and amplitude.
I have tried xcorr function with fft, but I cannot find how to do the phase shift with xcorr to make 2 signals in phase and then I can substract them.
It is hard to represent the signal by cosine function, so I really want to find the solution directly by data.
The attachment is my 2 data sets.
Here is how I do as suggestion from other thread:
[c,lags]=xcorr(Y1,Y2);
[~,iLag]=max(c(find(lags==0):end));
s3=circshift(Y2,[0 iLag]);
  2 Comments
nanren888
nanren888 on 10 Jan 2019
Edited: nanren888 on 10 Jan 2019
What do you mean by subtract/add?
z = x+y;
Can you explain what you actually want?
Your use of xcorr is as if you want to align them in some way.
is Y1 X1?
Is Y2 X2?
Nguyen Trung Kien
Nguyen Trung Kien on 10 Jan 2019
Yes, I mean I want to find the signal which is difference between 2 signals:
z = y - x;
But I have only echo data as in attachment in time domain, I cannot represent signal by cosine function.

Sign in to comment.

Answers (0)

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!