Plotting discrete time signals involving sumations in matlab.

1.9k Views Asked by At

Many of the examples I've encountered while looking for an answer are simple functions that do not involve summations.

Suppose I have the following function;

f(n) = sum(n*cos(n-k)) from k=-infinity to infinity

How would I go about making the discrete plot in MATLAB?

1

There are 1 best solutions below

3
On
f = 0;
n = linspace(-6*pi, 6*pi, 5000);     
k = -100;

for i = -k:k
    f = f + n*cos(n - i);
end

plot(n, f)
stem(n, f)

enter image description here

enter image description here