File Exchange

image thumbnail

PWM Signal from SoundCard

version 1.0 (1.46 KB) by

Create a pwm signal using a standard soundcard.



View License

PWM Signals are used in a wide area of applications. Examples are a servos used for positioning in electromechanical control design (mechatronic). Here is a simple function that allows to create a pwm signal with a standard soundcard. Parameters are: pulsewidth and time between pulse-starts.

One restriction is that the approach allows duty cycles up to 50% only.

All you need is to add at the output of the soundcard is a resistor as load (1k) and a diode (1N4001). The image enclosed shows the output I got for:

>> PWMSound(1.5e-3,10e-3);

Comments and Ratings (5)


Noé (view profile)

shanthanu chakravarthy

oldokh tsendayush

i analsysis matlab sinmklif

essalhi adil

pwm simulink

Oscar Campo

You can obtain different duty cicles by adding this line after the "dat" definition:


MATLAB Release
MATLAB 7.1.0 (R14SP3)

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

» Watch video

Win prizes and improve your MATLAB skills

Play today