Hello, I have been working on delaying any given signal with subsample accuracy (fractional+interger) delay in Frequency domain which results in simple phase change. I know there are functions available in toolboxes(example delayseq), but I would like to do it manually in my program. Here is the code i have written so far:
clc clear all close all Fs=1000; T = 1/Fs; % Sample time
L = 1000; % Length of signal
t = (0:L-1)*T; delta_T=2.345; %delay time in milliseconds
% Time vector
x = sin(2*pi*50*t);w=2*pi*50; %angular freq. component
X=fft(x);Y=X.*exp(-j*w*t*delta_T);y_1=abs(ifft(Y));%plot signals
figure;plot(Fs.*t(1:50),x(1:50))hold on;plot(Fs*t(1:50),y_1(1:50),'r');legend('Original signal','shifted signal');xlabel('time (milliseconds)')ylabel('amplitude');
[[Note: I have edited my previous code.]]
My goal is to delay or advance the above signal x (sine) by any amount of time (lets say by 2.345 milliseconds)
Iam getting a weird plot!! 🙁
Please help me what am I missing?
Thanks!
Best Answer