MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by Passband Modulation on 5 Oct 2012

it is really tedious, probably impossible, to do the following equation using a calculator. Please note that cosine and sine functions are in degrees

the result should b a scalar value if i am right?

*No products are associated with this question.*

Answer by Walter Roberson on 5 Oct 2012

Accepted answer

k = 0:65119; sum( cosd(3.6*k) .* sind(3.6*k) ).^2

Passband Modulation on 5 Oct 2012

cool, it really works. actually, i just manage to obtain the result using

function [S] = sum1(n) S = 0; % Initialize sum to zero k = 0; % Initialize index to zero % loop for calculating summation while k <= 65119 S = S + cos(3.6*k*pi/180)*sin(3.6*k*pi/180); % add to summation k = k + 1; % increase the index end

and then square the outcome, and get the answer as urs.

cool, urs looks tidier. many thx

## 3 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/49932#comment_103193

The equation seems to be missing from your Question ?

http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/49932#comment_103197

I see you have changed the wording of your question a little, and given the note about degrees, but the equation itself isn't there yet ?

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/49932#comment_103198

sry, i just reuploaded the image, could you now see the equation?