# How do you integrate a square wave?

1. Mar 5, 2012

### Evilinside

I'm doing homework where i have to find a function representation of the output signal from a simple op amp integrator circuit with a 4.7k resistor and a .01uf capacitor. I know i'm supposed to use the equation -1/rc * int vin(t) but the input is a square wave signal. I never learned how to integrate that. Can i anyone help me out? Do i have to use something called a fourier series or fourier transform?

2. Mar 5, 2012

### gnurf

This quote from wikipedia also applies to a square wave:

A definite integral of a function can be represented as the signed area of the region bounded by its graph.
Does that help?

3. Mar 5, 2012

### DragonPetter

This is a discontinuous function, so it is easier to integrate in sections. You need to do integrals over specifc intervals and you need to account for the initial conditions at each interval.

4. Mar 5, 2012

### Bob S

As pointed out above, you have to integrate each half cycle of the input square wave in sections. The basic form of the integration is

$$V_{out}(t)=\frac{-1}{RC}\int_t V_{in}(t) dt$$

Each segment is a straight line. The line is continuous, but its derivative is not. The output of the square wave is a triangle wave.

Bob S

5. Mar 5, 2012

### Evilinside

Yes I finally got the answer i think. I set the square wave input to 2V peak and i got an answer of (-4Vp/.000047)*t and since the frequency of the input square wave is 2000khz, the period is 500us. so (-4v/.00047)*t should be the graph of a triangle wave for the an interval of 0-500us and repeat itself every period after that. I think that's the answer anyway. Oh well whether I'm wrong or right, thx for help.