A middot B Sigmai1100 AiBi Write a computer program to comp
A middot B = Sigma_i=1^100 A_iB_i. Write a computer program to compute the sum in Eq. (6.24) for A = cos 2 pi i/100 and B = sin 2pi i/100 where i runs from 1 to 100. Do you get zero? Repeat the calculation for A middot A and B middot B. Do the numerical values of the dot products you obtain make sense? Briefly explain.
Solution
Program in matlab
clc;
clear all;
close all;
a= zeros(1,100);
b= zeros(1,100);
for i =1 :100
a(i) = cos(2*pi*i/100);
b(i) = sin(2*pi*i/100);
end
result = sum (a .*b)
result 1= a.*a;
result2= b.*b;
Answer
result = 0
result 1 = 48;
result 2 =48
