Robust MatLAB function to integrate discrete time-signal in frequency domain by dividing its Fourier spectrum with -iw (w = cyclic frequency); also see diffFD (frequency-domain differentiation function).
Dr. Erol Kalkan, P.E. (2021). inteFD (https://www.mathworks.com/matlabcentral/fileexchange/58999-intefd), MATLAB Central File Exchange. Retrieved .
nice function, thank U
Bojan: If you use + instead of - for the iw division operation, then the results will be out-of-phase.
Hi there, thank you so much for this function, it helped my understanding of Fourier transformation!
I have a small suggestion considering speed, though:
% Integrate in frequency domain by dividing spectrum with iomega
for i = 1:numel(z)
znew(i) = z(i)*-1i/w(i);
testTimeFor = toc;
zNewDot = z.*(-1i./w);
testTimeDot = toc;
testDiffDot = numel(find(znew ~= zNewDot));
zNewBsx = bsxfun(@times, z, bsxfun(@rdivide, -1i, w));
testTimeBsx = toc;
testDiffBsx = numel(find(znew ~= zNewBsx));
You use a for-loop, which takes 6.3 s to compute my 20e6 data points, whereas .* takes 0.08 s and bsxfun takes 0.13 s. You could consider changing the code to make it faster.
All best :)
Thanks for sharing Erol,
It runs smoothly but I'm a bit puzzled on the -iw division. From what I've been able to find on the Omega Arithmetic and looking trough the math part of the topic, the division should be done by +iw... Care to comment on this?
Works really well, Sir.
You may check DSP books for spectral domain analyses.
Dear sir, can you provide any references?
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!