(28 intermediate revisions by 22 users not shown) | |||
Line 16: | Line 16: | ||
7. Convolution implementation Write a Matlab function that per- | 7. Convolution implementation Write a Matlab function that per- | ||
forms convolution of two discrete-time input signals. Note that the | forms convolution of two discrete-time input signals. Note that the | ||
− | theoretical convolution defined in class has signals x[n] defined for | + | theoretical convolution defined in class has signals <math>x[n]</math> defined for |
− | n | + | <math> n \in ( -\infty , \infty )</math>. Since this is not practically realizable, have your code |
assume that a finite-length input signal is such that it is zero outside of | assume that a finite-length input signal is such that it is zero outside of | ||
− | the specified range. For example, both signals | + | the specified range. For example, both signals <math>x_1[n]</math> and <math>x_2[n]</math> plotted |
below can be represented by a vector in Matlab as [2, 3, 1]. Compare | below can be represented by a vector in Matlab as [2, 3, 1]. Compare | ||
your code’s functionality against the builtin Matlab function conv (type | your code’s functionality against the builtin Matlab function conv (type | ||
“help conv” on the command line for more information). | “help conv” on the command line for more information). | ||
− | So, are you saying that our code cannot call the function conv, but can use for loops even though they are slow. Just clarifying-- Adam Frey | + | * So, are you saying that our code cannot call the function conv, but can use for loops even though they are slow. Just clarifying-- Adam Frey |
+ | * Yes, your function may use loops, but should not call the conv function. I simply want you to write a function that works identically to conv. If you are feeling ambitious, you can try this without loops, though I would strongly recommend writing it using for-loops first. [[User:Huffmalm|Huffmalm]] | ||
+ | |||
+ | Another note: if you are unfamiliar, you may define functions in matlab by including "function" on the first line of your .m file. For instance, write | ||
+ | |||
+ | function y = myconv(x,h) | ||
+ | |||
+ | at the top of the script which performs convolution of x and h and calls the output y. Then save the function as myconv.m. In this way, the user can input x and h from the command line, and call your function simply by typing "myconv(x,h)" on the command line. [[User:Huffmalm|Huffmalm]] | ||
+ | |||
+ | |||
+ | * [[HW 3.7 - Arjun Bajaj 301_summer 09]] | ||
+ | * [[HW 3.7 - Navroz Kwatra 301_Summer 09]] | ||
+ | * [[HW 3.7 - Anish Venkat 301_summer09]] | ||
+ | * [[HW 3.7 - Howard Ho_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Ryne Rayburn_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Rob Swanson_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Nick Gentry_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Lu Zhang_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Joseph Yu_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Tyler Mattmuller_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Ted Schnittgen_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Adam Frey_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Vishal Ramani_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Muhammad Aizuddin Zulkifli_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - William Owens_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Shannon Abrell_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Yicheng Guo_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Adam Siembida_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - James Phillips_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Mohd Faiz Mohd Asri_ECE301_Summer2009]] | ||
+ | * [[HW 3.7 - Evan Witkoske ECE301 summer2009]] | ||
+ | * [[HW 3.7 - Jamis_Martin_ECE301_Summer2009]] | ||
+ | |||
+ | == Bonus (Convolution without loops) == | ||
+ | * [[Ted Schnittgen_ECE301_Summer2009]] | ||
+ | |||
Back to [[Homework]] | Back to [[Homework]] |
Latest revision as of 23:38, 1 July 2009
Contents
Problem 1
Problem 2
Problem 3
Problem 4
Problem 5
Problem 6
Add your Rhea contribution to the Course-Related_Material page
Problem 7
Adam has posted some Helpful Youtube videos which will be very helpful in working this problem. Nice find! - Landis
7. Convolution implementation Write a Matlab function that per- forms convolution of two discrete-time input signals. Note that the theoretical convolution defined in class has signals $ x[n] $ defined for $ n \in ( -\infty , \infty ) $. Since this is not practically realizable, have your code assume that a finite-length input signal is such that it is zero outside of the specified range. For example, both signals $ x_1[n] $ and $ x_2[n] $ plotted below can be represented by a vector in Matlab as [2, 3, 1]. Compare your code’s functionality against the builtin Matlab function conv (type “help conv” on the command line for more information).
- So, are you saying that our code cannot call the function conv, but can use for loops even though they are slow. Just clarifying-- Adam Frey
- Yes, your function may use loops, but should not call the conv function. I simply want you to write a function that works identically to conv. If you are feeling ambitious, you can try this without loops, though I would strongly recommend writing it using for-loops first. Huffmalm
Another note: if you are unfamiliar, you may define functions in matlab by including "function" on the first line of your .m file. For instance, write
function y = myconv(x,h)
at the top of the script which performs convolution of x and h and calls the output y. Then save the function as myconv.m. In this way, the user can input x and h from the command line, and call your function simply by typing "myconv(x,h)" on the command line. Huffmalm
- HW 3.7 - Arjun Bajaj 301_summer 09
- HW 3.7 - Navroz Kwatra 301_Summer 09
- HW 3.7 - Anish Venkat 301_summer09
- HW 3.7 - Howard Ho_ECE301_Summer2009
- HW 3.7 - Ryne Rayburn_ECE301_Summer2009
- HW 3.7 - Rob Swanson_ECE301_Summer2009
- HW 3.7 - Nick Gentry_ECE301_Summer2009
- HW 3.7 - Lu Zhang_ECE301_Summer2009
- HW 3.7 - Joseph Yu_ECE301_Summer2009
- HW 3.7 - Tyler Mattmuller_ECE301_Summer2009
- HW 3.7 - Ted Schnittgen_ECE301_Summer2009
- HW 3.7 - Adam Frey_ECE301_Summer2009
- HW 3.7 - Vishal Ramani_ECE301_Summer2009
- HW 3.7 - Muhammad Aizuddin Zulkifli_ECE301_Summer2009
- HW 3.7 - William Owens_ECE301_Summer2009
- HW 3.7 - Shannon Abrell_ECE301_Summer2009
- HW 3.7 - Yicheng Guo_ECE301_Summer2009
- HW 3.7 - Adam Siembida_ECE301_Summer2009
- HW 3.7 - James Phillips_ECE301_Summer2009
- HW 3.7 - Mohd Faiz Mohd Asri_ECE301_Summer2009
- HW 3.7 - Evan Witkoske ECE301 summer2009
- HW 3.7 - Jamis_Martin_ECE301_Summer2009
Bonus (Convolution without loops)
Back to Homework