Can somebody explain what is the algorithm to determin Sine

Can somebody explain what is the algorithm to determin Sine wave and Square wave of this code?

This code is used to to determin the Sine wave and Square wave fron oscilloscope.

Solution

Signal is represented in an array Signal values are the data points in plane like [1,-1,1,2,3,4 ...etc (Can be anything)]


Input : Signal is stored in Signal Array from 0 to 127 [Signal can be anything that i]

1. Print \"Starts with data processing\"
2. Then prints signal Array from 0 to 127
3. Finds the max and min values from Signal array.
4. Finds the mid from min and max calculated above.
5. Then runs the loop from 0 to 127 and tries to find out whether the signal is of type Sine wave or Square wave.
6. If at any time the Abs(firstval, secondval) i.e absolute value of first - second is greater than the mid value which means the signal is swuare wave otherwise not.
7. If wave is 1 means its a squatre wave and then trues to find period and frequency. Period is find out by taking two variables i and j.
8. First find the point i , A point where signal is greater than mid AND its next signal point is less than mid then we have found our i.
9. Next is to find j. Start from the point where i left. Next point where the same thing happens as above is our j.
10. Period is the difference between two points.
11. Frequecy is the recriprocal of period.
12. If the wave is not equal to 1 i.e wave is Sine wave .
13. Use the same thing we did for square wave i.e finding i and j and then finding period and frequency.
14. Print min, max, max -min.
15. Then find peck to peck voltage using the formula and prints the result.

Thanks, I hope it clarifies. Let me know if there is any concern.,

Can somebody explain what is the algorithm to determin Sine wave and Square wave of this code? This code is used to to determin the Sine wave and Square wave fr

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site