Connect with us

Need Equation for PWM

Discussion in 'General Electronics' started by jack, Apr 12, 2005.

Scroll to continue with content
  1. jack

    jack Guest

    Thanks for your reply...
    John Woodgate (in his previous reply) makes the same point about
    negative numbers and fractional exponents....however this isn't always
    true, is it? X^(1/2) is a no-no for negative numbers (i.e. imaginary
    result) but X^(1/3) is O.K. for negative numbers (real result). EXCEL
    treats both of these these correctly (error for X^(1/2) and real number
    for X^(1/3)). But EXCEL chokes on X^(2/3) for a negative number - this
    should be O.K. (real number result) for negative numbers....right?

    I will probably go with Equation 2, although how to incorporate duty
    cycle into the equation is still perplexing me.

    It's just a shame that a seemingly straightforward periodic function as
    a square wave (+1,-1,+1,-1,.....) could not be expressed as a
    straightforward function. If they can fake putting a man on the moon,
    why can't they figure this one out?
  2. Fred Bloggs

    Fred Bloggs Guest

    Well- if you know duty D and period T, then at any time t, the function
    is +1 if FRACT(t/T)<=D and -1 if FRACT(t/T)>D. If you have an offset,
    to, then use t-to for t in the above. How hard is that? Excel doesn't
    allow logic coefficients in expressions?
  3. jack

    jack Guest

    I said:

    Then you said:
    I assume you are being a hyper-stickler because I did not explicitly
    include a reference (Vo) voltage in my problem statement. Would you be
    O.K. if I had said instead:

    I think everyone else understood this as a given, which did not need to
    be explicitly stated.

    If this still doesn't satisfy you, then just do a Google search for
    "voltage as a function of time" +"edu" and you will get a ga-zillion
    hits showing how voltage can be expressed as a time function. Random
    example from Bucknell Univ.:

    No, you're orthogonal.
    Rather, I think you need to go back to Kindergarten and learn how not
    to be a ball-breaker over something that is obvious.
  4. jack

    jack Guest

    Life is truly tough. It is made up of a series of trick problems.
    In my original post I clearly indicated that I had done a fair amount
    of due diligence and wasn't asking without having done some homework
    already. The assumption in my original post was that there must be a
    straigtforward answer and since high-powered math-oriented folk
    frequent such internet groups, it might be a good place to ask....this
    should be an easy question IF the answer is indeed straightforward.

    Also, I did pay attention to the replies and patiently explained why
    responses were off-target or not what I was looking for. Check out my
    responses, I paid attention to all the replies and I always explained
  5. jack

    jack Guest

    Do you even know what a "square wave" is?
    Suggest you contact each of the authors (all somehow associated with
    educational institutions) of the approximately 745 web pages that show
    up when you Google the terms +"voltage equation" +"edu" and tell them
    they are "stupider than a joke"....

    Google Search:"voltage+equation"+

    Semi-random example page...this doesn't exactly look "stupider than a
    joke"...does it?
  6. jack

    jack Guest

    Was trying to get an elegant equation that avoided such things as
    special EXCEL functions, IF/THEN deals, piecewise deals (like
    Heaviside) and infinite series.
  7. numberdude

    numberdude Guest


    Assuming your square wave oscillates from some voltage V+ to V- at some
    frequency and duty cycle, here's a simple equation that will work. You *can*
    implement an IF statement in Excel very easily. Here's the equation:

    t = time in seconds
    f = frequency in Hertz
    d = duty cycle expessed as a decimal (e.g. 35% = 0.35)

    IF = tf - INT(tf) < d/f THEN V(t,f,d) = V+ ELSE V(t,f,d) = V-

    The INT function in Excel returns the whole number portion and drops the
    decimal part.

    tf - INT(tf) gives the fraction of the last wave completed after t seconds.
    d/f gives the fraction of a cycle where the voltage is V+. If the first
    fraction is less than the second, the voltage is V+. Otherwise it's V-.

    Hopes this helps.

  8. jack

    jack Guest

    Thank you very much.....I appreciate it.
  9. Dave Rusin

    Dave Rusin Guest

    Maybe. Some would say (-1)^(1/3) = (-1/2) + i sqrt(3)/2.
    Maybe. Some would say that -- with the exception of integer n , perhaps --
    the right definition of X^n is exp( n log(X) ), which forces such
    people to add "... for positive X only."
    Oh, we can fake this too. What you want is the straightforward function
    f(x) = squarewave(x). You got a problem with that? Most mathematicians
    would probably accept that answer. (Maybe after a beer or two.)

    You could also opt for f(x) = sin(x) / |sin(x)| or f(x) = (-1)^floor(x) .
    Much depends on what you're trying to accomplish. (You might already
    have said; I haven't been paying attention, sorry.)

  10. Guest

    I don't have a formula, but I do have a simple approach:
    If all you want is to know whether the signal (Vinst) is
    hi or low at any given instant, it is a simple divide and compare.

    From the frequency and duty cycle you compute total time
    for the cycle, and determine the "on time" from the duty cycle.
    Assume your pulse is positive going at time Tsubzero:
    Divide Tsubn by total time. If there is no remainder, the ampltude
    is at Tsubzero amplitude - high. If there is a remainder, and the
    remainder is greater than the "on time" the signal is low.
    If the remainder is less than or equal to the "on time" , the signal is
    If your signal is negative going instead of positive going at
    Tsubzero, it still works, but you have to invert the highs
    and lows in the description.

  11. numberdude

    numberdude Guest


    You're welcome. By the way, I noticed that I put an equals sign after the
    IF. It shouldn't be there.

  12. MG

    MG Guest

    Small correction to function parameters (arguments).
    Period is required, Phase is optional or default to zero.
    A (V) = f{t (sec), duty cycle (%), Period, Phase(%)}

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day