= create_1d_raised_cosine(
rc 1,
0.01,
0.05,
1,
44100,
)
plt.plot(rc)
Excitation functions
create_1d_raised_cosine
create_1d_raised_cosine (duration:float, start_time:float, end_time:float, amplitude:float, sample_rate:float)
Create a 1D raised cosine excitation with time parameters in seconds.
Type | Details | |
---|---|---|
duration | float | Total duration of the excitation (in seconds). |
start_time | float | Start time of the excitation (in seconds). |
end_time | float | End time of the excitation (in seconds). |
amplitude | float | Amplitude of the excitation. |
sample_rate | float | Sample rate (samples per second). |
Returns | ndarray | The excitation signal. |
create_raised_cosine
create_raised_cosine (Nx, Ny, h, ctr, epsilon, wid)
*Create a raised cosine function on a 2D grid.
Parameters: Nx (int): Number of grid points in the x-direction. Ny (int): Number of grid points in the y-direction. h (float): Grid spacing. ctr (tuple): Center of the raised cosine (x, y). epsilon (float): Scaling parameter. wid (float): Width of the cosine.
Returns: np.ndarray: Flattened raised cosine array.*
from matplotlib import pyplot as plt
# Example usage
= 25, 21 # Grid dimensions
Nx, Ny = 0.0438 # Grid spacing
h = (0.5, 0.5) # Center of the raised cosine
ctr = 1.2000 # Scaling parameter
epsilon = 0.3 # Width of the cosine
wid
= create_raised_cosine(
rc, X, Y, dist, distx, disty
Nx,
Ny,
h,
ctr,
epsilon,
wid,
)
="gray", origin="lower") plt.imshow(rc, cmap
create_pluck_modal
create_pluck_modal (lambdas:numpy.ndarray, pluck_position:float=0.28, initial_deflection:float=0.03, string_length:float=1.0)
Create a pluck excitation for a string with a given length and pluck position. The pluck is modeled in the modal domain.
Type | Default | Details | |
---|---|---|---|
lambdas | ndarray | eigenvalues of the Laplacian operator | |
pluck_position | float | 0.28 | position of pluck on the string in meters |
initial_deflection | float | 0.03 | initial deflection of the string in meters |
string_length | float | 1.0 | total length of the string in meters |
Returns | ndarray | The pluck excitation in the modal domain. |