File Exchange

image thumbnail

Square Wave Generator

version 1.3 (1.65 KB) by

Generate an array of values that represent a square wave.



View License

This is a simple function that returns an array of values that represent a square wave based on two essential inputs (total time and period) and four optional inputs (plot option, minimum amplitude, maximum amplitude, and resolution).

[f] = squareWave(time,per,plotChk,Amin,Amax,res)

Units are arbitrary, but time and amplitude are assumed.

The following examples illustrate its use:

[y] = squareWave(10,1);
[y] = squareWave(10,1,1);
[y] = squareWave(10,1,-1,1);
[y] = squareWave(10,1,-1,1,1);
[y] = squareWave(10,1,-1,1,1,1e5);

Comments and Ratings (0)



Updated examples in help section of M-file to be more intuitive.


Examples in file description appropriately updated.

MATLAB Release
MATLAB 7.9 (R2009b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video