Adding two time domain vectors

조회 수: 5 (최근 30일)
Alec Climer
Alec Climer 2012년 5월 11일
So I have two vectors, say A and B. They are generated by taking beats and rate as an input. This is an ECG problem. The vectors are in the form [x t], where x is magnitude and t is the time domain. If I generate 2 different frequency signals and want to add them how should I do that?

답변 (1개)

Wayne King
Wayne King 2012년 5월 11일
You just add the two vectors if they are the same length.
x = randn(200,1);
y = randn(200,1);
z = x+y;
The Fourier transform is a linear operator so the Fourier transform of x+y is just the Fourier transform of x + Fourier transform of y
  댓글 수: 1
Alec Climer
Alec Climer 2012년 5월 11일
They aren't the same length. The generator functions by making a template beat of 500samples, then making a vector of N*500 in length. The faster rate has more beats and therefor is a larger vector than the lower rate. The only difference is the scaling on the time vector.
Below is a solution I found, however this doesn't work well if the time steps aren't really multiples of each other...
x_comb=[];
for w=1:length(t)
ind=find(t_fet==t(w));
x_comb(w)=x_ad(w)+x_fet(ind);
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 ECG / EKG에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by