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 で Waveform Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!