フィルターのクリア

how to find angle between two signals

5 ビュー (過去 30 日間)
althuru pranathi
althuru pranathi 2016 年 7 月 26 日
回答済み: Sufiyan 2023 年 3 月 11 日
angle bw two given signals?how to find it usimg correlation??

回答 (1 件)

Sufiyan
Sufiyan 2023 年 3 月 11 日
Hello,
you can refer to the below code to find the angle between two signals using correlation.
% Define two signals
t = 0:0.01:10; % time vector
x = sin(2*pi*1*t); % signal 1: sine wave with frequency 1 Hz
y = sin(2*pi*1*t + pi/3); % signal 2: sine wave with frequency 1 Hz and phase shift of pi/3
% Calculate the correlation between the two signals
corr_vector = xcorr(x, y);
% Find the index of the maximum value in the correlation vector
[max_value, max_index] = max(corr_vector);
% Calculate the time lag in samples
time_lag = max_index - length(x);
% Calculate the angle between the two signals
sample_rate = 100; % sample rate of 100 Hz
angle = (time_lag / sample_rate) * 360;
fprintf('The angle between the two signals is %.2f degrees.\n', angle);
The angle between the two signals is 57.60 degrees.

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by