Need Equation for PWM

in article snipped-for-privacy@z14g2000cwz.googlegroups.com, jack at snipped-for-privacy@yahoo.com wrote on 4/11/05 10:35 PM:

Life is truly tough. It is made up of a series of trick problems. solve them for yourself. Don't ask others to do it for you, especially if you pay no attention to the replies.

Bill

Reply to
Repeating Rifle
Loading thread data ...

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?

Reply to
jack

Well- if you know duty D and period T, then at any time t, the function is +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?

Reply to
Fred Bloggs

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.:

formatting link

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.

Reply to
jack

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 myself.

Reply to
jack

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:

formatting link

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

formatting link

Reply to
jack

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.

Reply to
jack

Jack,

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:

Given: 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.

Allen

Reply to
numberdude

Thank you very much.....I appreciate it.

Reply to
jack

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.)

dave

Reply to
Dave Rusin

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 high. 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.

Ed

Reply to
ehsjr

Jack,

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

Allen

Reply to
numberdude

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(%)}

MG

Reply to
MG

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.