memphis_1220
Limp Gawd
- Joined
- Aug 28, 2004
- Messages
- 499
Hi. I have a problem with an applet that I am creating. It is an oscilloscope but there is one problem. Here is the section of code:
timeSelection is an integer i.e 10, 100, 1000, in order to stretch the wave when the time/div is changed.
offsetIn is just to move the wave vertically to a particular position.
voltsSelection is the same as timeSelection only stretching it vertically.
amplitudeValue is a value obtained from a JSlider.
frequencyValue is a value obtained from a JSlider.
When I compile and run this code, this is what happens:
Does anyone know why this is happening? Also, when I change the frequency, it seems to just revert back to 0 (flat line) and increases a bit and then back again.
I would really appreciate some input.
Thanks
Mike
Code:
x[i]=i*timeSelection + 250; // x-coordinate calculation
y[i]= offsetIn + (int)(voltsSelection*amplitudeValue*Math.sin(frequencyValue*i));
timeSelection is an integer i.e 10, 100, 1000, in order to stretch the wave when the time/div is changed.
offsetIn is just to move the wave vertically to a particular position.
voltsSelection is the same as timeSelection only stretching it vertically.
amplitudeValue is a value obtained from a JSlider.
frequencyValue is a value obtained from a JSlider.
When I compile and run this code, this is what happens:
Does anyone know why this is happening? Also, when I change the frequency, it seems to just revert back to 0 (flat line) and increases a bit and then back again.
I would really appreciate some input.
Thanks
Mike