How to find the similarities between two waveforms and point of deviation ?
2 views (last 30 days)
Show older comments
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;
0 Comments
Answers (2)
Mathieu NOE
on 11 Dec 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);
0 Comments
See Also
Categories
Find more on Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!