Your task is to write a program that will draw graphs and output them as a full colour 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 components of a square wave.
You will need to write a program that allows the user to specify how many harmonic
components to include in the plot. Your Signals and Systems or Mathematics knowledge
should enable you to make the appropriate calculations.
The data from each harmonic should be displayed – in a different colour – and the resultant
waveform also displayed. The resultant signals should be output as a single file in the .ppm
format. 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.
Design a user interface allowing the user to specify the waveform they wish to construct and
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 ela010task1.c
Any functions you write should 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 ela010task1.c

Files :
- Source files functions.c, functions.h, ela010task2.c
- Executable file ela010task2.exe.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.