Plot square wave where duty cycle is a function

Discussion in 'Math' started by anhnha, Mar 5, 2016.

  1. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    773
    45
    I have a square wave where duty cycle is a function of time as below. How can I plot the square wave?
    d(t) = 0.5 + 0.1cos(t).
    I am confused because at each point in time there is a duty cycle but the definition of duty cycle should be in a period.
     
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,779
    1,103
    What is the pulse period? Unless you know that you can't plot the waveform against an actual time scale.
     
  3. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    773
    45
    Let's assume that the frequency is 1kHz or period 1ms.
    BTW, I think that there is a contradiction here. The duty cycle can be a function of time but it should be constant in a period.
     
  4. wayneh

    Expert

    Sep 9, 2010
    12,094
    3,033
    I've used this approach to throb an LED. I set the duty cycle of a PWM output to follow a sine wave. It produces a very nice effect.

    Of course: PWM frequency >> throb frequency
     
  5. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    773
    45
    With PWM frequency >> throb frequency, so in a period of PWM signal, duty cycle can be approximated as a constant but actually it is not a constant at all. So I am wondering what the PWM signal will be if duty cycle is not a constant.
    Here is what I am confused from the power electronics lecture. How is it possible get a square wave gate drive from that duty cycle d(t)?

    duty cycle.PNG
     
    eanidal likes this.
  6. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,779
    1,103
    I don't see a contradiction. A period can have only one duty-cycle, but the 'mark' duration can vary from one period to another.
     
  7. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    773
    45
    I agree with you about this. However, for the definition of duty cycle function in post #1 or #5, it is a continuous with t and in a switching period the duty cycle is not a constant.
     
  8. WBahn

    Moderator

    Mar 31, 2012
    17,720
    4,788
    This is similar to the instantaneous frequency in a frequency modulated system except that there it is a better defined since everything is continuous and so it make more sense to talk about different frequencies at different points within the same period.

    Here I can imagine a few things. First, imagine that you have not only the rectangular wave output, but a linear ramp that goes from o to 1 over the course of the period. When that ramp first exceeds your d(t) signal that is when your rectangular wave drops from HI to LO. I could also imagine sampling d(t) at the beginning of each period to ensure that each period has one defined duty cycle.
     
  9. wayneh

    Expert

    Sep 9, 2010
    12,094
    3,033
    That depends on the details of the PWM generator. In my case I was changing the duty cycle setting every tenth of a second or so. Since the throb took several seconds, updating every tenth second gave very smooth operation.

    The PWM would run at a constant duty cycle until the next update. I have no idea how it dealt with a change that arrived during a cycle. It's irrelevant at a practical level, since there were hundreds of full cycles for every one change cycle.
     
  10. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    773
    45
    This works but then the duty cycle is not actually the one defined above. It is sampled of d(t) and is discontinuous.

    I see how it works in your case because d(t) is discontinuous here.
     
  11. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,779
    1,103
    To define the pulse width within any period you have to pick an end-of-pulse moment. Do you regard that as continuous or discontinuous?
     
  12. anhnha

    Thread Starter Active Member

    Apr 19, 2012
    773
    45
    Not really sure what you mean here.
    Here is what I meant by continuous or discontinuous:
    d(t) = 0.5 + 0.1cos(t) for all positive value of t: this is a continuous. At each value of t there is one duty cycle. Even in a switching period, there is infinite duty cycle because there is infinite point in time t within that period.
    d(t) = 0.5 + 0.1cos(t) is discontinuous if in each switching frequency there is only one value of at which the function is defined.
     
  13. wayneh

    Expert

    Sep 9, 2010
    12,094
    3,033
    Suppose the PWM frequency is nearly the same as that of the sine wave, and suppose your job is running the PWM duty cycle in response to that sine wave. How would you decide what to do? There is no singular answer. Different designers would take different approaches. The question cannot be answered without looking at a specific device.

    Using LTspice to model a simple 555-based PWM driver might give you what you want. It wouldn't be hard to simulate what you've described.
     
  14. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,779
    1,103
    Even LTspice will be 'discontinuous', since it calculates in discrete, albeit brief, time steps. Any practical pulse generator will also differ from the ideal continuous implementation.
     
  15. wayneh

    Expert

    Sep 9, 2010
    12,094
    3,033
    I was picturing putting a sine wave onto the control pin of the 555, and watching the PWM. Or something like that. I don't know what the TS is looking for but maybe seeing a simulation would trigger the aha moment.
     
Loading...