# How to find Convolution in Matlab? (Easy Approach)

**convolution matlab** This is a topic that many people are looking for.

**thevoltreport.com**is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today,

**thevoltreport.com**would like to introduce to you

**How to find Convolution in Matlab? (Easy Approach)**. Following along are instructions in the video below:

hello so this is a continuation of the of the last lecture I have taken titled ammunition in MATLAB okay so in this what we are going to do is we going to use a different method the method is very simple again explain it to you okay so we want to continue it you know this signal X of n where is this signal HSN now in this method we create a people language okay the table how to create the table tennis the depreciated in this value we will do X of n multiplied by the front value of HSN okay and this X of n will write it as a column and multiply it with one so you will get in a 1 into M is all of these means multiplied into one you can say that is one one two and three furthermore what well do is we multiply the same room will the second value of each other giving us one in x 2 2 1 x 2 2 2 then 2 4 & 3 general statistics now we see that you know H that deducted in H of n NZ so for for simplicity sake you know for right now is to just show off the table books what are done is put 0 0 so that we end up with a square matrix okay whole rows and 4 columns once that is done so we have created are developing this table will help us find out the convolution market so well mark them we must reach tables and you know these kind of diagonals and this will be like one section this is the other section is the third section sports and so on okay in each of these sections well be adding it across the diagonally if these are not you know the the normal diagonals that you talk about markets this one but these are you know in this fashion okay now this is the important part for the first element of the convolution if you remember the answer that we had got you know in the last example the same example you continue from blasting get down to answers 1 3 4 7 & 6 you can verify from the last video here if you if you add these numbers across these the lines that I have taken we will get the terms of a condition like for example this you know across the first Aguilar we have 1 which is the first term here across the second diagonal we have 1 plus 2 which gives 3 which is the second term the third diagonal is our stupid – 4 which is the third term and so on ok so if we just keep adding you know numbers across the diagonals of this table then we will find a condition as so this is also a way of finding conclusions it is you know one of the shortcut or one of the easier ways of finding it and as we go to implement this in MATLAB you see that as we focus women listen math labs you will see that this is much simpler mean within the last method that I deserve so thats it I will just go to MATLAB and you know we can see how the camera okay so coming back to our favorite software MATLAB we will see how we can you know establish the logic that we just read in so to test this files and using the same input same data signal and as we had considered in last examples the only change in this test program Im doing the only change in this test order I am doing is Im changing the function from convolution 1 to convolution – okay attaining the

function from convolution 1 to condition 2 so this is the advantage of using functions is that even if you change you know a small part of the coherence of the change in a lot of things this entire program is same as the bus program Ill just change this way then dilution is implemented I have also kept the input and output formats same so that you know nothing else needs to begin so let us now see how the confucian program is you can the community to program this is a much shorter code than before Im using none of the the earlier functions that we have used all the functions used in this fight are all defined in MATLAB we do need to feed anything extra okay so this part of the poor should be pretty much clear to you if you have seen the last video whatever it is basically is just reading the time access for community okay now the task we had in hand was like stood on my glasses are X X was 1 1 one one two three days it is pretty difficult but is that your ex was 1 1 2 3 and our H and n was H was 1 & 2 okay so the matrix is lets say the message that you want to create is called Y and we know that it will look something like this 1 1 2 3 & 2 2 4 6 okay the first column comes because you know this thing into 1 the second column comes because of the same thing into 2 okay now how do you create this matrix so the codes are written to you know to create this matrix is this one okay I you know I largely depend on vectors notations or the subscript notation that I was talking about and the reason I stick to it is very because it is very interesting and it makes the code simple so to get the first column what we can do is we can multiply this entire matrix with 1 now this entire matrix is a row matrix okay and youre multiplying it is 1 which is just a single constant see when we consider of you know the entire H we know H is a 1 cross 2 matrix and X is a or 1 / 4 matrix but now I am NOT interested in multiplication of X and H Im interested in multiplication of X the entire row matrix into H 1 right so this multiplication in the normal multiplication it is like multiplying a row matrix or multiplying formatters any matrix with a scalar value so the dimensions of it will not change but is what we have is 1 1 2 3 into 1 will give you 1 1 2 3 now this 1 1 2 3 I want to save it in white as a column method again it is X is a row matrix multiplying with edge with scalars will just give you again the same row matrix but I want to save it and buy as a column okay so how am i saving it and why I am painting it white as you know different rows and the first column okay because this is like you know your Row 1 Row 2 Row 3 Row 4 and this is your first call okay so the way to change this is you write a simple instruction I would like okay let me change the color I will write Y okay y colon comma 1 equals x into h1 okay just there should be an asterisk in between the X into H 1 is simple 1 1 2 3 into 1 okay and I change this as by colon comma 1

see we know that when you write in your subsequent batches the first value shows road okay and the second value here shows column now we are sure that the data that will come here we have to store in first column that is not changing so we can keep it as a constant 1 right and we know that the rows that will come will depend we dont know what the rules are right but what we want that we want it to be showed at rows so I put a colon here the goal is stand in this case for all weather radar just Y of all rows comma first column is equal to X intellectual okay it will try to make this idea very clear because it is very useful and madmen so Y of Y of all rules because I have written a colon comma first column is equal to X into again the night you built for the first column you know for the first column of by using that for the second column what we will do we will do y : – right because Y of order rolls second column is equal to simply X into H – right now how many such columns will be get em nice has columns will be okay the number of columns we will get will depend on the length of H okay they will depend on the length of it so what is the length of Edge has a length of H is simply you know the length of M so we will run so you know instead of you know writing in a y : 1 y : – for every design we will put it on a simple loop so that the program becomes general register okay so you put for I is equal to 1/2 length of M in this case the n will be M will be your minus 1 and 0 and length of M will be 2 so Y is equal to 4 hi is equal to 1 – do you have Y code and I is equal to X into H into H of 5 okay so this piece of code these two lines here you know it gives us our table so once our table is defined if you remember once the table is defined we need to add the diagonal elements like this okay we need to add these diagonals limitation so what I do is again let us take a simple copy model let us take an example but you display in a specter or let us actually see this slide here so what Ive got us so this is the table that will create right we have done in this box I extend this table for the Romney knows convenience and ease zeros so as G 0 here working the reader will be very clear right on so the first element will come by this diagram okay so Y of 1 1 the first element here is simply Y of 1 comma it holds your first one on the same lines by of Y of T that is the conclusion second element in the continuation its by of one cover to this element plus by up to come on this is why three the similar limit into consideration is y of 1 comma 3 in our in our original Madrid you know it is only of this side so we dont have these detail but for the sake of programming changes implemented zero zero energy modes happen okay the Y of 1 comma 3 this term okay so the diagonal that we are considering is this diagonal okay why you are one form of the system is 2 comma 2 and biopsy column and

so on so its iffy if you go on by the start and you can see the pattern that is forming is here you know here for each term a lets say Y of poles we start by one and I the row number will keep increasing again 1 2 3 4 we increase is this value N and the column numbers start decreasing hole 3 2 & 1 ok so to implement this you know if you see the sum of these terms okay once the foetus 5 plus 3 is 5 plus 2 is 5 focus on inside we can have 1 loop again till lets say you have a for loop in that I will vary from like tape a photo post them when you are talking you will vary I swung one to pull and you simply have Y of something you know whatever term then your c4 by your full is okay why why of course is why by or spoon just Y of I okay this is the rope or for where is 1 2 3 4 1 2 3 4 you have your group forma 4 minus I so Palma hi – and what is that what is that when you put it by PI minus one even is one you will get one comma PI minus 1 which is 4 which is a first term right then I is to just cook over PI minus 2 which is 3 right second thing first important so writing it in this form writing it in this form has generalized by this equation right is that clear now the region we are writing this equation is writing in this fall in generalized mass equation only problem I am having right now is 4 by 4 which is this term you know these two things are non existence if this is 0 or not equation so the first and second terms Y of 1 comma 4 and Y are stuck on TVs are non-existent for me but they do not exist what I can do is in this virus I can write some gift condition that when youre 34 you know why of I did not exist in the what is not added into the form okay now lets go back to the program it does go back to the program and well take it out this okay so in one program it till this part it was clear this part it was clear that we have managed to make our edges okay here we will define the length of a solution of X okay here designing by wise okay second visiting this answer that will store information well fill it up the zero the reason for doing that denim is here as early find it so lets look at the Technodrome so how many times will be run the main for loop okay the main sort of hell run the number of times or for each term in the convolution will have two hundred one now how many terms are there the conclusion there are n n the length of n n so then M is equal to your capital n is equal to 1/2 length of that is the number of times it will run okay so then n is equal to 1 you will get a value of 1 by Phi of either 3 and so on now this loop is should be run for every YY okay so for Wi-Fi on one you will run this loop or Y biopsy you could run this depends to one okay so for Y value of one your n will become one right so you will run this one you will have J instead of having I and n minus 1 n plus 1

minus 1 what Im doing is Im having I comma J and G I am depending here okay J is your n plus or minus I this this equation I discussed before right so the first you will have Y Y of 1 equals y y of 1 plus whatever is your stable element okay if you are searching for y by of to Y divided by of to let my arm to and you know the number of table is in this is equation here this is statement here it is used to you know to remove the the extra zeros that we are added right this formula this formula here as you start you know the table is big enough and then an extra extra value system so this is root it allows your programs enter into this only for those values in the tables that are existing okay only for those that will it will just equal all y TB has kept if I is equal to if I is less than equal to length of n okay which will show your room and if J is equal to less than M which is your fun so your your the tip the table is only defined for you know n values n rows and M columns okay apart from this anything you have added is not part of your actual system right these are your 0 that you have added so we has put this is line that if I and J are belonging to this group only then we need some nc was not something right I think that my explanation was good enough in case you do not understand you know you give me a point out big spot you understand and we can you know study it together so once that is done once that is done our system is ready okay so the reason I told you that we had used this line is figure what you are doing it by of n is equal to Y of n plus something initially so lets say youre doing Y of P by Y of 2 equals y Y of P plus something so if y Y of 2 is not existent then this will give this Liston get an ax lab error like so for the first time you run by by you what we can we can filter your frugal deal okay you can initially start or by by matrix in which there are all 0 again and slowly you can add things together to get you know your answer one in going from the 47 fix it initially they are 0 to make this initial matrix you are using this year using this language okay so you are initially populating the Wi-Fi and slowly your program this change the value of y I can get the conventional so thats it in just under system indicator so in a test voice I just used a spectrum the function can be written to which we have defined here it is a condition to fight and just one thing of the pouring of watering it other is rectify the mistake I had made earlier you will read the titles oh so this is your title X of n this is why Phil HSN and the last one is by of em okay lets change this file and on it once you run it you will need a convolution here c-13 for several sticks assign minus one zero one okay and this is load this is your problem except n-h-s-n and biotech okay thank you for watching this video this is one easy way of implementing convolution positives in the next video I will show you how to do convolution with the addition formula and you

tags:

DSP, Matlab, Convolution, SVNIT, Digital Signal Processing

Thank you for watching all the articles on the topic **How to find Convolution in Matlab? (Easy Approach)**. All shares of thevoltreport.com are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.