Here is a code snippet in Matlab to create a ramp signal with limits at 1:
main.m200 chars7 lines
The createRampSignal
function takes in the number of desired samples as input and returns a ramp signal that starts at -1 and ends at 1. The signal is created by incrementing from -1 to 1 in equal steps. Then, any values above 1 or below -1 are constrained to 1 and -1, respectively.
You can modify the function to change the minimum and maximum limits as needed.
gistlibby LogSnag