MATLAB Convolution: Finding the Convolution of Two Functions with Step Inputs

In summary, the conversation discusses using MATLAB to find the convolution between two step functions, f(t) and g(t). The attempt at a solution involves using the heaviside function to define the step functions and the conv function to find the convolution. However, the output graph does not match the expected values and it is determined that multiplying by the step size is necessary to approximate the integral and get the correct output.
  • #1
Les talons
28
0

Homework Statement


Use MATLAB to find the convolution between
a) ##f(t) = u(t) -u(t -3)## and ##g(t) = u(t) -u(t -1)##

Homework Equations



The Attempt at a Solution


t = -10: 0.1: 10;
f = heavisde(t) -heaviside(t -3);
g = heaviside(t) -heaviside(t -1);
t = -20: 0.1: 20;
c = conv(f, g);
plot(t, c)

The graph of the convolution has values from 0 to 10. I don't get how the convolution can get to 10 if the functions being convolved only have maximum values of 1. I changed the line to
c = 0.1*conv(f, g);
and this produced the right output. Why do I need to multiply by the step size?
 
Physics news on Phys.org
  • #2
Convolution is a sum over element-wise products. To turn this into the equivalent approximation for the integral, you have to multiply by the step size. Think about the rectangular area. Matlab applies the linear algebra definition of convolution.
 
  • Like
Likes Les talons

What is convolution in MATLAB?

Convolution in MATLAB is a mathematical operation used to combine two signals or functions. It is represented by an asterisk (*) and is commonly used in image processing and signal analysis.

How do I perform convolution in MATLAB?

To perform convolution in MATLAB, you can use the built-in function "conv". This function takes two input signals and outputs their convolution. The syntax is "C = conv(A,B)", where A and B are the input signals and C is the resulting convolution.

What is the difference between convolution and correlation in MATLAB?

Convolution and correlation are similar operations in MATLAB, but they differ in the way the second signal is "flipped" before being multiplied with the first signal. In convolution, the second signal is flipped horizontally and vertically, while in correlation, it is only flipped horizontally.

Can I use convolution in MATLAB for image processing?

Yes, convolution is commonly used in image processing to apply filters and enhance images. The convolution operation can be applied to a 2D image by convolving it with a 2D filter.

Are there any limitations to using convolution in MATLAB?

One limitation of using convolution in MATLAB is that it can be computationally expensive for large signals or images. Additionally, the resulting convolution may be affected by the edges of the signals, which can lead to artifacts in the output. Other techniques, such as zero-padding or using other types of filters, can help mitigate these limitations.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
776
  • Calculus and Beyond Homework Help
Replies
5
Views
199
  • Calculus and Beyond Homework Help
Replies
12
Views
1K
  • Calculus and Beyond Homework Help
Replies
11
Views
5K
  • Calculus and Beyond Homework Help
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
208
  • Calculus and Beyond Homework Help
Replies
1
Views
692
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
23
Views
2K
  • Calculus and Beyond Homework Help
Replies
2
Views
944
Back
Top