Simulating Sawtooth Wave in Excel: Tips & Tricks

  • Thread starter Thread starter BiGyElLoWhAt
  • Start date Start date
  • Tags Tags
    Excel
AI Thread Summary
To simulate a sawtooth wave in Excel using a Fourier series, it’s essential to sum multiple frequencies for accuracy and use a sufficient number of data points. Users can streamline their process by utilizing Excel's column functions, allowing them to write formulas once and copy them both down and across, significantly reducing repetitive tasks. A suggested formula structure involves using a combination of sine functions and summing results across columns to achieve a rough approximation of the desired wave shape. The discussion highlights the importance of efficient formula management to avoid re-entering numerous calculations. Overall, leveraging Excel's capabilities can simplify the simulation of complex waveforms.
BiGyElLoWhAt
Gold Member
Messages
1,637
Reaction score
138
I hope this is the right place for this question.

I had to do a Fourier series for a sawtooth wave f(t) = t from 0-1 and simulate it in excel, and put it through a low pass filter, also done in excel.

I've been having problems with the filter, but that's beside the point.

I have the Fourier series done; once I made the spreadsheet and had a perfect sawtooth wave when I graphed my points. The problem is this: in order to get something I would consider a good sawtooth wave, you need to sum a good amount of frequencies for each point and you need A LOT of points to demonstrate its "sawtoothiness"; also I seem to have misplaced my file.

Is there a faster way to do this in excel other than plugging a bunch of functions into each cell and then dragging them down 100 or so terms? I believe in my original I went somewhere near BZ 150 square (with some graphs of course). I really don't want to have to type 100~ formula's again.

Some sample codes:

My t values
=ROW()/50 - 0.02 (C column)

my Fourier transform results
=-SIN(2*ROW()*PI()*($C$2))/(ROW()*PI())
where row*pi is n*pi from my Fourier series results (and this is dragged out a lot of columns)

and I guess that's about it, but I need to go through and amend that formula around 100 times to go from C2 to C* (again, my t values), 1 for each column out a lot of terms.

Is there a way to increment things via columns? I'm already using my row's for n values.
 
Physics news on Phys.org
You should be able to get at least a crude approximation with just 10 terms of the FS. Your graph will look better if you use the half range cosine but never mind that. Using your formulas you can still do it.

You only have to write the formula once and you can copy it both down and across. I took your example with the following cells:

A1 through A10 are then numbers n = 1 to 10.

In the cells A14 to T14 I put =(column()-1)/20 to space t values from 0 to .95.

In B1 put this formula and copy it from B1 to T10

=-(2*(-1)^$A1/($A1*PI()))*SIN($A1*PI()*A$14)

In row 12 sum the columns from B to T. These sums give the values of the first ten terms of the FS for your 20 points. When you plot them you will see a rough approximation to f(x) = x.
 
  • Like
Likes 1 person
LCKurtz said:
You should be able to get at least a crude approximation with just 10 terms of the FS. Your graph will look better if you use the half range cosine but never mind that. Using your formulas you can still do it.

You only have to write the formula once and you can copy it both down and across. I took your example with the following cells:

A1 through A10 are then numbers n = 1 to 10.

In the cells A14 to T14 I put =(column()-1)/20 to space t values from 0 to .95.

Awesome, In my google searching I never came across that column function. It seems to act exactly how I need it to.

LCKurtz said:
In B1 put this formula and copy it from B1 to T10

=-(2*(-1)^$A1/($A1*PI()))*SIN($A1*PI()*A$14)

In row 12 sum the columns from B to T. These sums give the values of the first ten terms of the FS for your 20 points. When you plot them you will see a rough approximation to f(x) = x.

Hey thanks again LC, I'll give it a shot here and post back if I'm not getting what I'm looking for =]
 
Thread 'Have I solved this structural engineering equation correctly?'
Hi all, I have a structural engineering book from 1979. I am trying to follow it as best as I can. I have come to a formula that calculates the rotations in radians at the rigid joint that requires an iterative procedure. This equation comes in the form of: $$ x_i = \frac {Q_ih_i + Q_{i+1}h_{i+1}}{4K} + \frac {C}{K}x_{i-1} + \frac {C}{K}x_{i+1} $$ Where: ## Q ## is the horizontal storey shear ## h ## is the storey height ## K = (6G_i + C_i + C_{i+1}) ## ## G = \frac {I_g}{h} ## ## C...
Back
Top