calculating residual between two time domain signals

12 views (last 30 days)
Hello,
I have two time domain signals, e.g.:
y1= 3*cos(10*t+180*pi/180);
y2= 2*cos(10*t+60*pi/180);
What is the correct procedure for calculating the residual of these two signals? The current code I am using is below, where I am simply subtracting the two signals to get the residual signal. I am not sure if the residual is correct and whether the affect of phase difference is taken into account in this calculation.
clear all ;
close all;
clc;
t= 0:0.001:1;
% first signal vector (larger magnitude)
y1= 3*cos(10*t+0*pi/180);
% seond signal vector (smaller magnitude)
y2= 2*cos(10*t+180*pi/180);
% residualI tried
y3=y1-y2;
%% plots
figure
plot(t,y1)
hold on
plot(t, y2)
hold on
plot(t,y3)
legend ('y1', 'y2', 'residual')
mat1.png
Furthermore, the residual signal should be of smaller amplitude then the parent signals, isnt it so? I realise that can be achived by simply adding the signals instead of subtracting(y3= y1+y2 gives the figure below) them but is that the correct way?
mat2.png

Accepted Answer

Daniel M
Daniel M on 16 Oct 2019
Edited: Daniel M on 16 Oct 2019
It's unclear what you're trying to achieve, but yes that how to calculate the residuals (the difference between the observed value, y1 = f(x), and the estimated value, y2 = f(x*), where x* is an approximation of the unknown x). They are not necessarily smaller than the parent signals. It is what it is. You should try to determine algebraically what happens when you subtract two sine waves, in the general case.
  8 Comments
Tuhin Choudhury
Tuhin Choudhury on 16 Oct 2019
Right, it is completely dependent on the type of signal. Also, its true that the defects may induce vibrations of variable frequencies in the fan. However, in my case, I am dealing with the 1X component of the signals only; meaning that I have already filtered out the random noise and the vibrations at higher harmonics (or any vibrations at any other frequency for that matter).
For your example case:the 0.5*rand(size(t)) (noise) and the higher frequency vibration componenet due to defect (1.2*sin(2*pi*9.5*t + pi/3)) would have been already eliminated. I am stuck at the next step, where I am calculating the difference between the pure 1X signals before and after the defect.
t = 0:0.001:10;
x1 = 3*sin(2*pi*10*t); %+ 0.5*rand(size(t));
x2 = 2*sin(2*pi*10*t + pi);% + 1.2*sin(2*pi*9.5*t + pi/3) + 0.5*rand(size(t));
figure
plot(t,x1,t,x2)
Daniel M
Daniel M on 16 Oct 2019
The residuals, as it stands, would be res = x1-x2; However, I suspect that would not give you a satisfying result, and you would prefer to subtract the two signals as if they were in phase. Then what you need to do is find the phase difference between the two signals. (Here we know it because we have the equation for the signal, but in the general case we will not). To do this, you can curve fit your signals, or use fzero, as in this example:
Once you have the phase, you can shift one of your signals by that phase amount, then subtract them to get the residuals. Shifting the phase can be done using the fft, but can also be done in the time domain by just padding one of your signals, if you know the relationship between time and your index.

Sign in to comment.

More Answers (0)

Categories

Find more on Measurements and Feature Extraction in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!