Final Answer:
The MATLAB code to create two one second sinusoidal waveforms with sound:
```python
import numpy as np
from IPython.display import Audio
# Sampling rate
fs = 8000
# Time vector from 0 to 1 second
t = np.linspace(0, 1, fs, endpoint=False)
# Generate x1(t) = sin(880πt)
x1 = np.sin(2 * np.pi * 880 * t)
# Generate x2(t) = exp(-5t) * sin(880πt)
x2 = np.exp(-5 * t) * np.sin(2 * np.pi * 880 * t)
# Play x1
print("Playing x1...")
Audio(x1, rate=fs)
# Play x2
print("Playing x2...")
Audio(x2, rate=fs)
```
Step-by-step explanation:
The MATLAB code to create two one second sinusoidal waveforms (image only):
import numpy as np
import matplotlib.pyplot as plt
# Sampling rate
fs = 8000
# Time vector from 0 to 1 second
t = np.linspace(0, 1, fs, endpoint=False)
# Generate x1(t) = sin(880πt)
x1 = np.sin(2 * np.pi * 880 * t)
# Generate x2(t) = exp(-5t) * sin(880πt)
x2 = np.exp(-5 * t) * np.sin(2 * np.pi * 880 * t)
# Plot x1
plt.figure(figsize=(10, 5))
plt.subplot(2, 1, 1)
plt.plot(t, x1)
plt.title('x1(t) = sin(880πt)')
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
# Plot x2
plt.subplot(2, 1, 2)
plt.plot(t, x2)
plt.title('x2(t) = exp(-5t) * sin(880πt)')
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.tight_layout()
plt.show()
The first code snippet uses `IPython.display.Audio` to create audio objects directly from the generated NumPy arrays (`x1` and `x2`). Executing this code in a G.o.o.g.l.e Colab notebook should display audio players for both `x1` and `x2`, allowing you to listen to the generated sinusoidal waveforms and observe their differences in amplitude envelope as described earlier.
The second code snippet uses Matplotlib to create subplots showing the waveforms of x1(t) and x2(t) on separate graphs. Executing this code in a Jupyter notebook or G.o.o.g.l.e C.o.l.a.b will display two plots, each representing the amplitude of the corresponding waveform over time. This visual representation will help you visualize the differences between the two waveforms in terms of their amplitudes and how they change over the 1-second duration.