Question: Write two Matlab scripts that will calculate the following sum: y = sigma_k cos(3 pi k)e^-2[k] where the integer k starts at -20 and ends

 Write two Matlab scripts that will calculate the following sum: y

Write two Matlab scripts that will calculate the following sum: y = sigma_k cos(3 pi k)e^-2[k] where the integer k starts at -20 and ends at 20, but skips over k = -3 and k = 3. Note that the Matlab command that implements the exponential is exp, so that e^2 is calculated as exp(2). In the first script (name this mysumfor), implement the calculation using a for loop and if statements. In the second script (name this mysumvec) use vectorization and the Matlab command sum. You may also find the line k = [-20: -4 -2: 2, 4: 20] useful (try it and see what happens). Hand in your m-file scripts

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!