<jupyter_start><jupyter_text>Plotting Sine and Cosine Wave in Python<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
plt.plot()
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Sine Wave<jupyter_code>Time = np.arange(0,200,0.1)
Amplitude = np.sin(Time)
plt.plot(Time, Amplitude)
plt.title('Sine Wave')
plt.xlabel('Time')
plt.ylabel('Amplitude=sin(Time)')
plt.grid(True, which="both")
plt.axhline(y=0, color='b')
plt.figure(figsize=[206,106])
plt.show()<jupyter_output><empty_output><jupyter_text>Cosine Wave<jupyter_code>time = np.arange(0,10,0.1)
amplitude = np.cos(time)
plt.plot(time, amplitude)
plt.title('Cosine Wave')
plt.xlabel('Time')
plt.ylabel('Amplitude=cos(time)')
plt.grid(True, which="both")
plt.axhline(y=0, color='b')
plt.show()<jupyter_output><empty_output><jupyter_text>Plotting Sine*Cosine wave<jupyter_code>time = np.arange(0,10,0.1)
amplitude = np.cos(time)*np.sin(time)
plt.plot(time, amplitude)
plt.title('Cosine-Sine Wave')
plt.xlabel('Time')
plt.ylabel('Amplitude=cos(time)*sin(time)')
plt.grid(True, which="both")
plt.axhline(y=0, color='b')
plt.show()
x = np.arange(0,8*np.pi,0.1)
y = np.cos(x)*np.sin(x)
plt.plot(x,y)
plt.title('Cosine_Sine Wave')
plt.xlabel('Time')
plt.ylabel('Amplitude=cos(x)*sin(x)')
plt.grid(True, which="both")
plt.axhline(y=0, color='r')
plt.show()<jupyter_output><empty_output><jupyter_text>Plotting Damped Oscillation<jupyter_code>time = np.arange(0,8000,4)
amplitude = 1008*np.sin(time/108)*np.exp(-time/1008)
exponential_decay = 1008*np.exp(-time/1008)
reciprocal_exponential =1/1008*np.exp(time/1008)
sinusoidal_wave=1008*np.sin(time/108)
plt.plot(time, sinusoidal_wave,color='cyan')
plt.plot(time, exponential_decay, color='red')
plt.plot(time, amplitude, color='indigo' )
plt.title('Damped Oscillation')
plt.xlabel('Time')
plt.ylabel('Amplitude')
plt.grid(True, which="both")
plt.axhline(y=0, color='yellow')
plt.show()<jupyter_output><empty_output><jupyter_text>Sine-Cosine wave together but seperate<jupyter_code>x=np.arange(0,8*np.pi,0.1)
y=np.sin(x)
z=np.cos(x)
plt.plot(x,y,x,z)
plt.show()<jupyter_output><empty_output><jupyter_text>Soundwave graph: Wave Packet<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

x = np.linspace(0, 10.0, num=50000)
plt.plot(x, np.sin(x*4*np.pi), 'r')
plt.plot(x, -np.sin(x*1.1*2*np.pi), 'b')
plt.plot(x, np.sin(x*2*np.pi) - np.sin(x*1.1*2*np.pi), 'g')
plt.show()
x = np.linspace(0, 100.0, num=5000)
plt.plot(x, np.sin(x*4*np.pi), 'b')
plt.plot(x, -np.sin(x*1.1*2*np.pi), 'r')
plt.plot(x, np.sin(x*2*np.pi) - np.sin(x*1.1*2*np.pi), 'g')
plt.show()
x = np.linspace(0, 1000.0, num=500)
plt.plot(x, np.sin(x*2*np.pi), 'b')
plt.plot(x, -np.sin(x*1.1*2*np.pi), 'r')
plt.plot(x, np.sin(x*2*np.pi) - np.sin(x*1.1*2*np.pi), 'g')
plt.show()<jupyter_output><empty_output><jupyter_text>Plotting the result of a Fourier transform   Let's try a Fourier transform of a sine wave signal with a pure frequency, namely, $$f(t) = \sin(2 \pi \nu t)$$,sampled for $t = j \Delta t$ with $j = 0, 1, \ldots{}, N-1$. To get a pure frequency, we set,$$\nu = \nu_m = m/(N \Delta t)$$so that, for frequency $\nu_m$, our discretized signal becomes$$f_j = \sin(2 \pi m j/N)$$.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
N=15
t=np.arange(N)
m=9

nu=float(m)/N
f=np.sin(8*np.pi*nu*t)
ft=np.fft.fft(f)
freq=np.fft.fftfreq(N)
plt.plot(freq, ft.real**2, ft.imag**2)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2071263035921205, 'fraction_numerical': 0.03997682502896872, 'mean_word_length': 6.883561643835616, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '34355', 'license': 'MIT', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1572, 'n_words': 248, 'path': 'Python Fundamentals2.ipynb', 'repo_name': 'Daya-Ram/Wave-Plot-', 'size': '3452'}