![]() ![]() Subplot in MatLab is used to display the data, and it can be used as a “graphical representation” of the data. It can be used to represent the data in an interactive way by providing the data as a new column with each row. It is a “plot” for the purpose of understanding or summarizing the data. Here n2 is the length of convolution signal minus 1 because we start with a 0.What Is The Use Of Subplot In Matlab? Subplot in Matlab is a graphical representation of the data in a MATLAB program. Subplot (3,1,3), so 3 rd, we plot an X w.r.t n1, so plotting a signal, we use stem function take stem (n2, X). ![]() Subplot(3,1,2), so 2 nd we plot an h1 w.r.t n1, so plotting a signal we use stem function take stem(n1, h1). subplot(3,1,1), so 1 st we plot a y1 w.r.t n1 to plot a signal, we use the stem function, stem is used to plot a discrete-time signal, so we take stem(n1, y1). For plotting three signals, we 1 st plot Figure 1 in the signal figure we plot three signals using a subplot function. And the convolution result we stored in the X variable. Now convolution can be performed in MATLAB using the command conv conv is an abbreviation of convolution that is the 1 st 4 words of convolution conv of now place 1 st signal name y1 and comma for separated place 2 nd signal name h1. We take h1 equals to in square brackets 1 1 1 2 1 -1 1 1. These numbers are taken in the square bracket, and then we take h1, h1 is an impulse response. Now we take the first signal in the y1 variable as 1 2 3 1 2 3 4 5. In this example, we perform the sum of the two signals firstly, we define an n1 variable as 0 to 7 with a difference of 1. We put a clc at a beginning of the code to just clear the command window after running this code. Now we convolve both the signals y1 and y2 and we are going to save the result in variable Y convolution can be performed in the matlab using a command conv, convis a abbreviation of convolution that is the 1 st 4 words of convolution conv of now place 1 st signal name y1 and comma for separated place 2 nd signal name y2. Then we generate a 2 nd signal as y2 equals to cos of 2 * pi * fr2.* t1, where fr2 is 2 nd signal frequency and t1 is a time duration. Now generate a 1 st signal as y1 equals to sin of 2 * pi * fr1.* t1, where fr1 is 1 st signal frequency and t1 is a time duration. Now we generate a frequency of the first signal as a 10 hertz this assign to fr1, and we generate a frequency of the second signal as a 15 hertz this assign to fr2. For generating time duration, we are taking it as 0 to 2 with a difference of 1, and this time duration we take in a t1 variable. This example is about how to calculate the result of the convolution of two different signals in a matlab. Step 4: If we want to plot three signals, we use a subplot and stem functions.įollowing are the examples are given below: Example #1.Step 3: Perform a convolution using a conv function on Matlab. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |