How to find the similarities between two waveforms and point of deviation ?

2 visualizaciones (últimos 30 días)
I have two waveforms. One is applied signal say x and another one is y. y follows the signal x upto some point of time and then it deviates. I need to know the particular point from which it deviates ? I have tried to find the coherence between them but it is not working. kindly help me out with this.
time is defiend as
t = 0:1/109.58:5;

Respuestas (2)

Voss
Voss el 11 de Dic. de 2023
load x
load y
t = 0:1/109.58:5;
figure
hold on
plot(t,x,'.-')
plot(t,y,'.-')
idx = find(abs(x-y) > 0.01, 1);
xline(t(idx),'--','LineWidth',2)
xlim(t(idx)+[-0.15 0.15])

Mathieu NOE
Mathieu NOE el 11 de Dic. de 2023
hello
according to my code , this time is : t_sep = 2.4913
NB that when you plot the data and decide to take the time index where the error is above the given threshold, you are probably already one sample too late - so that's why I opted for the sample before the time where the error starts to diverge
t = 0:1/109.58:5;
load x.mat
load y.mat
err = abs(y-x); % abs error
% time instant where err>tol
tol = 1e-6*max(x);
ind=find(err>tol);
ind = ind(1) - 1; % you must take the sample before
t_sep = t(ind)
y_sep = y(ind);
err_sep = err(ind);
subplot(2,1,1),plot(t,x,'b',t,y,'r',t_sep,y_sep,'dk','Markersize',15);
subplot(2,1,2),plot(t,err,'b',t_sep,err_sep,'dk','Markersize',15);

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by