private double getSine(int t) {
double amplitude = 5.0;
double period = 20000 / 2 * Math.PI;
double sin = amplitude * Math.sin(t + period);
return sin;
}
private double getSine(int t) {
double period = 2 * Math.PI / 20000;
double sin = Math.sin(t / period);
return sin;
}
Then I do:for (int t = 0; t <=20000; t+=1000) {
double sin = getSine(t);
System.out.println (t + "\t" + sin);
}
public class MySine{
public MySine(){
for (int t = 0; t <=20000; t+=1000) {
double sin = getSine(t);
System.out.println (t + "\t" + sin);
}
}
private double getSine(int t) {
double period = (2 * Math.PI) / 20000.0;
System.out.println("number " + ( t* period));
System.out.println("number " + ( t*period));
double sin = Math.sin(t*period);
return sin;
}
public static void main(String [] args){
new MySine();
}
}
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Java JRE greater than 1.6 | 5 | 51 | |
eclipse shortcuts | 9 | 45 | |
servlet doXXX methods | 3 | 39 | |
Configure a Bean in an XML file | 4 | 14 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
26 Experts available now in Live!