help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: square waves


From: NZG
Subject: Re: square waves
Date: Mon, 10 Apr 2006 11:46:32 -0500
User-agent: KMail/1.8.3

A generalized approach to Paul Kienzle's suggested method.

## v = pwms(t,period,duty)
##
## square pulse width modulation
##
## period in units of samples, duty is the fraction the pwm is "high".

function v = pwms(t,period,duty)

pw = period*duty;

v = pulstran(t,(period -pw/2):period:length(t),'rectpuls',period*duty);

endfunction 

NZG



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]