x(t) = cos(45πt),Generate samples from x(t). The sampling interval is 0.005 sec. Denote the samples as x1[n]. Plot x1[n].
时间: 2023-12-14 17:36:09 浏览: 60
MySQL中报错:Can’t find file: ‘./mysql/plugin.frm’的解决方法
5星 · 资源好评率100%
To generate samples from x(t), we need to first define a sampling rate. Let's set the sampling rate to 200 Hz, which means we will take 200 samples per second.
We can calculate the sampling interval as follows:
sampling interval = 1 / sampling rate = 1 / 200 = 0.005 sec
Next, we can generate samples from x(t) using the sampling interval:
x1[n] = cos(45πnT), where T = 0.005 sec
To plot x1[n], we can use Python and matplotlib. Here's the code:
```python
import numpy as np
import matplotlib.pyplot as plt
# Define sampling rate and interval
fs = 200
T = 1 / fs
# Define time axis
t = np.arange(0, 1, T)
# Generate samples
x = np.cos(45 * np.pi * t)
# Plot samples
plt.plot(x)
plt.xlabel('Sample index')
plt.ylabel('Amplitude')
plt.title('x1[n]')
plt.show()
```
This will generate a plot of x1[n] with the sample index on the x-axis and the amplitude on the y-axis.
阅读全文