MATLAB: How to sum unknowns and plot

sum

How to solve the equation x:
x = sum of k from -10 to 10 (1/4*k * ((cos(2*k*(t/T))-1)^2 + (sin(2*k*(t/T))))^2)
where t and T are unknown and plot the answer.

Best Answer

I used two statements for ‘x’ and ‘sum_x’ for clarity. They could be combined in one statement:
t = pi; % Create Data

T = 10; % Create Data
k = -10:10;
x = (1/4*k .* ((cos(2*k*(t/T))-1).^2 + (sin(2*k*(t/T)))).^2);
sum_x = sum(x);