I should convolve my signal with which function to have the signal itself?

3 views (last 30 days)
I should convolve my signal with a function and have the signal itself. I read on the internet that dirac function will be the solution but I convolved it with my signal and all the points became NaN. I don't know what is the problem. I used the same time line as the time line of my signal.
  2 Comments
Benjamin Thompson
Benjamin Thompson on 11 Jul 2022
Yes, symbolically the dirac function is the identify operation for convolution.
But if you are doing this in MATLAB there are a lot of questions such as whether you are doing it symbolically or numerically. Please sumit some code as an example.
2NOR_Kh
2NOR_Kh on 11 Jul 2022
I used this loop:
for i=1:n
%for j=1:1%this is #of frames so for now I am just working on one frame
fgc(:,i)=conv(dirac(tt),e(:,i));
%fg(:,i)=filtfilt(Gt,10,e(:,i));
%end
end
actully I have a RF data of ultrasound that the final result is an image but each line of it is 1D signal, I can apply my conv in both 2D or 1D. In this loop, I applied it in 1D.

Sign in to comment.

Accepted Answer

2NOR_Kh
2NOR_Kh on 11 Jul 2022
I find out my issue with dirac.
tt = -100:0.1:100
tt = 1×2001
-100.0000 -99.9000 -99.8000 -99.7000 -99.6000 -99.5000 -99.4000 -99.3000 -99.2000 -99.1000 -99.0000 -98.9000 -98.8000 -98.7000 -98.6000 -98.5000 -98.4000 -98.3000 -98.2000 -98.1000 -98.0000 -97.9000 -97.8000 -97.7000 -97.6000 -97.5000 -97.4000 -97.3000 -97.2000 -97.1000
y=dirac(tt);
idx=y==inf;
y(idx)=1;
plot(tt,y);

More Answers (1)

Paul
Paul on 11 Jul 2022
Hi Donya,
dirac is only defined in the Symbolic Math Toolbox and so should only be used for symbolic math, and only for continuous time analysis as well.
The SMT has another function kroneckerDelta that can be cast to a double and used for discrete-domain processing as with conv().
But you can easily write your own unit pulse function for integer-valued input
u = @(n) double(n==0);
This function will, of course, work for non-integer input if that's needed for some reason.

Categories

Find more on Applications in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!