Question
In an application, suppose x = [x1, x2, x3, x4, x5, x6, x7]. This is what we want to do. We want to compute the
In an application, suppose x = [x1, x2, x3, x4, x5, x6, x7]. This is what we want to do. We want to compute the vector y whose elements are to be found as follows: rst element of y should be x1+x32+x3. second element of y should be x2+x33+x4. third element of y should be x3+x34+x5. fourth element of y should be x4+x35+x6. fth element of y should be x5+x36+x7. Stop here since theres no more value in x. Write a MATLAB script (use a for loop) to implement the above logic. Test if your code is working properly by using x = [1, 2, 3, 4, 5, 6, 7] and other arbitrarily dened x vectors (of length 500, say). Believe it or not, what you have just implemented is a digital low pass lter, which can be used to remove (somewhat) screechy sounds from an old audio tape (after digitizing it, of course, say into a wav or an mp3 le). Now try to generalize your code as follows: introduce a variable named WINDOW. The value which is assigned to this variable should control how many elements of x are to be averaged every time (and therefore also the denominator). As the problem has been described, WINDOW = 3 since we are averaging over 3 elements of the x vector every time. If WINDOW = 4, we would compute y as follows: rst element of y should be x1+x2+4x3+x4. second element of y should be x2+x3+4x4+x5. third element of y should be x3+x4+4x5+x6. fourth element of y should be x4+x5+4x6+x7. Stop here since theres no more value in x.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started