H
harryos
hi
I was trying to calculate the value of
x(t)=cos(2*pi*10*t)+cos(2*pi*25*t)+cos(2*pi*50*t)+cos(2*pi*100*t) for
some values.I wrote this code
....
public static void main(String[] args) {
double m1=0.0;
double m2=0.0;
double m3=0.0;
double m4=0.0;
double y=0.0;
for(int t=0;t<3;t++){
debug("t="+t);
m1=Math.cos(Math.PI*2*10*t);
m2=Math.cos(Math.PI*2*25*t);
m3=Math.cos(Math.PI*2*50*t);
m4=Math.cos(Math.PI*2*100*t);
y=m1+m2+m3+m4;
System.out.println("m1="+m1);
System.out.println("m2="+m2);
System.out.println("m3="+m3);
System.out.println("m4="+m4);
System.out.println("y="+y);
}
}
....
however ,I got the following output
t=0
m1=1.0
m2=1.0
m3=1.0
m4=1.0
y=4.0
t=1
m1=1.0
m2=1.0
m3=1.0
m4=1.0
y=4.0
t=2
m1=1.0
m2=1.0
m3=1.0
m4=1.0
y=4.0
-----
I don't understand this..For example, the value of cos(2*pi*10*1)
should be cos 62.832 which is .4566 .Instead I am getting the value 1.
can somebody help me find out if I am doing something wrong?
thanks
harry
I was trying to calculate the value of
x(t)=cos(2*pi*10*t)+cos(2*pi*25*t)+cos(2*pi*50*t)+cos(2*pi*100*t) for
some values.I wrote this code
....
public static void main(String[] args) {
double m1=0.0;
double m2=0.0;
double m3=0.0;
double m4=0.0;
double y=0.0;
for(int t=0;t<3;t++){
debug("t="+t);
m1=Math.cos(Math.PI*2*10*t);
m2=Math.cos(Math.PI*2*25*t);
m3=Math.cos(Math.PI*2*50*t);
m4=Math.cos(Math.PI*2*100*t);
y=m1+m2+m3+m4;
System.out.println("m1="+m1);
System.out.println("m2="+m2);
System.out.println("m3="+m3);
System.out.println("m4="+m4);
System.out.println("y="+y);
}
}
....
however ,I got the following output
t=0
m1=1.0
m2=1.0
m3=1.0
m4=1.0
y=4.0
t=1
m1=1.0
m2=1.0
m3=1.0
m4=1.0
y=4.0
t=2
m1=1.0
m2=1.0
m3=1.0
m4=1.0
y=4.0
-----
I don't understand this..For example, the value of cos(2*pi*10*1)
should be cos 62.832 which is .4566 .Instead I am getting the value 1.
can somebody help me find out if I am doing something wrong?
thanks
harry