Question: I have to plot a cosine wave starting from 1 Hz. After plotting 1Hz cosine wave, increase the frequency to 2Hz and add 1Hz and 2Hz together and plot it. This has to be done till 9Hz. For the summation, need to use a 'for loop'.
Here is my attempted code:
After running the code, it shows no error, but the plots are blank.
- I am guessing somehow my loops are getting overwritten. What is the mistake I am doing?
- Also, is there any way to implement subplots dynamically so I don't have to write them manually?
If you know any answer/answers to my questions, kindly help. Thank you!