Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class SinusoidalWaveform
- {
- int[] angleArray= null;
- int[] resultArray= null;
- public SinusoidalWaveform(double minAngle, double maxAngle, int size)
- {
- for (int j=0; j < size;j++)
- {
- for (double i=minAngle; i <= maxAngle; i++)
- {
- angleArray[j] = (int)((i*(2.0d*Math.PI))/size);
- resultArray[j] = (int)(Math.Sin(angleArray[j])) ;
- }
- }
- }
- public override string ToString()
- {
- string result = "";
- for (int i=0; i < angleArray.Length; i++)
- {
- result += string.Format(
- "anglearray[{0}]= {1:F2}, resultarray [{2}]= {3:f2}\n",
- i, angleArray[i], i, resultArray[i]);
- }
- return result;
- }
- }
- class TestProgram
- {
- public static void Main()
- {
- SinusoidalWaveform w;
- w = new SinusoidalWaveform ( 0.0d, 2.0d * Math.PI, 20 );
- Console.WriteLine( w );
- }
- }
Add Comment
Please, Sign In to add comment