Amplitude of the convoluted signal?

18 views (last 30 days)
Alessandro Mingotti
Alessandro Mingotti on 12 Mar 2020
Commented: Image Analyst on 13 Feb 2022
Hi all,
i'm modelling some measurement devices and I need the conv function of Matlab.
Hence, lets define A = conv(B, C); where B has 20 k points and C 5 k points. A will have 24999 points, but what happens to its amplitude? I've tried thousand of simulations but i cannot see any relation between the amplitudes. In other words, I always find that A amplitude has a coefficient factor but i don't know where it cames from.
I've already tried introducting the samplimg frequency of the signals, but nothing.
Thank you in advance.

Answers (3)

Pawel Jedrejko
Pawel Jedrejko on 4 Aug 2021
For anyone looking for an answer in future:
I had the same problem, then I found in the documentation that conv() is actually just multiplying and summing, not 'integrating'.
Multiplying the output times dx (discretization step size) does the job.
  2 Comments
Justin Kim
Justin Kim on 13 Feb 2022
Thank you this was super helpful!
Image Analyst
Image Analyst on 13 Feb 2022
Yes, the x "units" of the result are the same as for the inputs, which should both have the same units. So if you just want "elements" as the units, it's that way already. However if you consider the units to be units of time, like the distance between two adjacent elements is 1 millisecond, then the output will be the sum of the values of the first signal times the second signal, summed up. Where the signals don't overlap, as the one slides past the other, the sum is zero there. If you want the output to be an "integration" like an area with units of (y units) * (x units) you'd have to multiply the result by the "delta x" distance, like 1 millisecond. It's like if you pretend the signal is a bar chart and to get the area of the bar you multiply by the y value of the bar (which has the units of the first signal) by the units of the width of the bar, which is either unitless (meaning just elements) or units of the x axis (liek one bar is 1 millisecond wide). The units of the second signal, the "kernel" are usually unitless since it's basically weighting factors that get multiplied by the first signal. This will get you the area of all the bars in real world units.

Sign in to comment.


Mahesh Taparia
Mahesh Taparia on 16 Mar 2020
Hi
The amplitude of the convoluted signal will be the sum of the product of elements of the two vectors with different range of those vector indices. For more information check the formula of the convolution in the documentation page
  4 Comments
Alessandro Mingotti
Alessandro Mingotti on 19 Mar 2020
Hi,
i'm trying to find a relation between the amplitudes of the convoluted signals and the result of the convolution.
Here my example of code. Sinc of amplitdue 1, sine with amplitude 1. The amplitude of the convolution must have a relationship between those two, but I cannot find it
clear all
close all
N = 201;
K = 10;
NsuK = N/K;
f = 50;
% sinc
m = -(N-1)/2 : 1: (N-1)/2;
x = sin(pi*m*K/N)./sin(pi*m/N)/K;
NaN = find(isnan(x));
x(NaN) = K/K;
% sine
m1 = -4*(N-1)/2 : 1: 4*(N-1)/2;
y = sin(2*pi*m1*8/length(m1));
% Conv
z = conv(y, x);
plot(x)
Mahesh Taparia
Mahesh Taparia on 19 Mar 2020
There is a relation between z and x,y. The conv function works as per the convolution formula.The link to that formula I already shared in my previous reply.

Sign in to comment.


Image Analyst
Image Analyst on 5 Aug 2021
If you don't want the convolved signal to be in a different range than the input signal, make sure that the kernel sums to 1. For example
windowSize = 5;
kernel = randi(99, 1, windowSize); % Whatever filter you want.
% Normalize to 1
kernel = kernel / sum(kernel(:));
outputSignal = conv(inputSignal, kernel, 'same');
Now the overall mean of the output will equal the overall mean of the input, so mean(outputSignal) will equal mean(inputSignal).

Categories

Find more on Measurements and Feature Extraction in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!