Your task is to write a program that will draw graphs and output them as coloured image in
the .ppm file format and display them using a suitable external image viewer (IrfanView).
The program will use code generated sine waves, and harmonics of these, to calculate and
display the harmonic components of a square wave.
All sine wave harmonic should be displayed, each in a different colour – and the square
wave that results from summing all the sine waves should also be displayed.
The resultant waveforms should be output as a single file in the .ppm format. Initially,
assume an image 256 pixels wide by 128 pixels high with a colour depth of 8 bits for each
channel. There should be two full cycles of the waveform under construction across the
width of the image. The background colour should be black, and any axes or labels you add
should be in white. Check the resulting file, using the image viewer IrfanView. A sample of
output for 5 harmonics is given at the top of this assignment
Design a user interface allowing the user to specify the number of harmonic components to
use. The user should also be able to re-run the calculation without exiting the program.
The code containing your main() function should be in a file called wsa010cwk.c
Any functions you write can be in the same file as main, but can also be implemented in a
separate C source file in your project, called functions.c. You will need to write a
prototypes file, functions.h which should be #included at the top of
functions.c and wsa010cwk.c
- Source files wsa010cwk.c and if used functions.c, functions.h,
- Executable file wsa010cwk.exe.