フィルターのクリア

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

3 ビュー (過去 30 日間)
Sayanta Goswami
Sayanta Goswami 2023 年 12 月 11 日
回答済み: Mathieu NOE 2023 年 12 月 11 日
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;

回答 (2 件)

Voss
Voss 2023 年 12 月 11 日
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 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);

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by