How to find the similarities between two waveforms and point of deviation ?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Mathieu NOE
2023-12-11
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!