cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Fourier series example problem

Teddy
11-Garnet

Fourier series example problem

Good day. 

 

I was hoping you could help me with my assignment on programming a fourier series analysis. 

 

Can someone teach me how to graph this on mathcad prime? I need to find the function that will replicate the attached file below. 

 

Your help would be much appreciated, since I am still learning from this software.

 

Thank you in advance and God Bless.

1 ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:Teddy)

From the help of Mathcad programming.

image.pngimage.pngimage.png

View solution in original post

34 REPLIES 34
Fred_Kohlhepp
23-Emerald I
(To:Teddy)

We'd love to help!

 

Please attach your Mathcad file so we can see what you have so far.

In the attached file you will find everything required and more.

Sawtooth+sawtooth- sawtooth+-.jpg

Teddy
11-Garnet
(To:-MFra-)

This examples would surely help me a lot in my future references. I am still learning a lot from this software. My professor introduced me to mathcad last 3 months and I am still trying to explore these things.

 

I really appreciate your response for helping me. 

 

Thank you.

On the graphing stage, I do not have any idea on how I would graph it, but here is my file on my fourier series exam. 

Cornel
17-Peridot
(To:Teddy)

CornelBejan_0-1616938246896.png

 

CornelBejan_2-1616938340674.png

 

 

Cornel
17-Peridot
(To:Teddy)

Mathcad Prime:

CornelBejan_0-1616939578784.png

CornelBejan_1-1616939598094.png

 

 

 

LucMeekes
23-Emerald III
(To:Cornel)

Nice,

but, how would you proceed if you had to extend it from -100, 100...

There's a handy mathematical function, also available in Prime, that allows you to convert a running variable (like t is) to a short sequence..

It is somewhat related to division. I'll spoil your assignment no further.

Anyway, here is the result:

LucMeekes_0-1616945452887.png

 

Success!
Luc

Teddy
11-Garnet
(To:LucMeekes)

Spoil me more, please. I am badly running out of time for my problem set. I really appreciate you for helping me out.

Teddy
11-Garnet
(To:Cornel)

How can I use this if I want an infinite number of expansion? like if I use a multiple number of expression "n" so it will not be limited to 6pi?

 

I really appreciate your response for helping me. 

 

Thank you.

Teddy
11-Garnet
(To:Cornel)

Can I ask for a lower version of your mathcad prime? I can't open it. Thank you.

ttokoro
20-Turquoise
(To:Teddy)

From the help of Mathcad programming.

image.pngimage.pngimage.png

Teddy
11-Garnet
(To:ttokoro)

Can i verify the variables that you used?

N is the maximum number of expansion

L is the number of period

Z is the final value of the series.

 

If possible, elaborate it for me. Thank you so much.

ttokoro
20-Turquoise
(To:Teddy)

N is the maximum number of expansion: Yes.

L is the number of period                        : L is the 1/2 of the period of the fundamental waveform, in your case L=2*pi.  

Z is the final value of the series.             : Yes Real and Imaginary indexes from o to N.

 

Teddy
11-Garnet
(To:ttokoro)

I'm so amazed on how you can think of such programs. 

 

I need to study more. 

 

do you mind if I ask one more? what does res() does, and on the 3 variables on the functions that you gave (FC(f,N,L), can you explain them? What does the first, 2nd and 3rd variable does to the whole program.

 

I am having a hard time exploring this software. I hope you can enlighten me so I can use this on my research in the future.

Cornel
17-Peridot
(To:ttokoro)

@ttokoro

CornelBejan_0-1617042496207.png

CornelBejan_1-1617042521419.png

CornelBejan_2-1617042557617.png

CornelBejan_3-1617042569032.png

CornelBejan_4-1617042576483.png

I want to implement your variant for a square wave signal.
What is wrong with my implementation of your variant for a square wave?
What I am doing wrong?

LucMeekes
23-Emerald III
(To:Cornel)

'It's a sin'...

In your definition of p(x) you've got cos in both terms under the sum.

The second should be sin

 

Success!
Luc

Cornel
17-Peridot
(To:LucMeekes)

Ah...
Yes, it works now...after correction.

CornelBejan_0-1617048541311.png

CornelBejan_1-1617048614643.png

Thank you for your remark and sight.

Cornel
17-Peridot
(To:ttokoro)

@ttokoro@LucMeekes@-MFra-@Fred_Kohlhepp@Teddy     

It would be interesting and nice, for those who want and have time, of course, to add other graphs in this topic (besides the one in the sawtooth and square wave signals), that can be used with @ttokoro  functions to generate such graphs and calculate the corresponding Fourier series.

-MFra-
21-Topaz II
(To:Cornel)

Some time ago, I published in the community a collection of periodic signals (there are one or two signals to correct), about forty, if I am not mistaken. You have to search for all the content.

signal and spectra.jpg

LucMeekes
23-Emerald III
(To:Cornel)

You can use an even simpler function (no programming required, works also in Prime Express) to calculate the Fourier coefficients of a periodic function:

LucMeekes_0-1617199232930.png

As an example, take a square wave as a function of t, with period T, offset O and amplitude A:

LucMeekes_1-1617199303272.png

e.g.:

LucMeekes_4-1617199571780.png

Define:

LucMeekes_5-1617199658802.png

Calculate the Fourier coefficients:

LucMeekes_8-1617199969020.png

(Note that Re and Im are Premium functions, they do not work in Express,

but they can be easily built with:

LucMeekes_7-1617199768785.png

)

Now you can build the Fourier representation with either one of:

LucMeekes_9-1617200198828.png

The first uses the A and B vectors and the sine and cosine functions. The second uses the array C with complex values.

The results are:

LucMeekes_10-1617200384986.png

I've offset the Fes(t) function by 0.2 to be able to see it alongside Fs(t)

 

You can cut it short in a single function now, defined as:

LucMeekes_11-1617200935189.png

Example for a triangle:

LucMeekes_12-1617200979988.png

Last example:

LucMeekes_0-1617201973943.png

Now it's up to your imagination regarding periodic functions.

 

Success!
Luc

Cornel
17-Peridot
(To:LucMeekes)

@LucMeekes@ttokoro@Fred_Kohlhepp@-MFra-@Teddy     

How can achieve the Fourier spectrum for these kinds of signals that were derived in this topic?

For example:

CornelBejan_2-1617300981343.png

 

CornelBejan_4-1617301091353.png

 

CornelBejan_5-1617301134104.png

 

CornelBejan_6-1617301182255.png


These images are an example to show you the idea.
I think you know what it is all about ... the Fourier spectrum of a signal.
The spectrum does not necessarily have to be performed for the signals in the image, but for those that have been deduced in this topic, but it is also possible for these of course.
But as much as possible to use @ttokoro functions.

LucMeekes
23-Emerald III
(To:Cornel)

To create a spectrum from data, use the dft() function. It is built into Prime.

Be sure to consult the online help and view the examples provided by Prime.

 

Success!
Luc

Teddy
11-Garnet
(To:LucMeekes)

What do you mean by creating a spectrum from data? is this the same as the spectral acceleration of any earthquakes?

Fred_Kohlhepp
23-Emerald I
(To:Teddy)

A Fourier transform takes the time history of a measurement and "transforms" it to display information (magnitude and phase) against frequency.  This information is sometimes called the frequency spectrum.  If you have the spectrum of an earthquake, the magnitude and phase of the frequencies of an accelerometer, you could recreate the time history of the earthquake.

 

That would be one example.

ttokoro
20-Turquoise
(To:Teddy)

image.pngimage.pngimage.png FFT needs 2^n data for evaluate the spectrum.

image.png  dft can evaluate the spectrum for non 2^n data set. image.png

Cornel
17-Peridot
(To:ttokoro)

Can you put a Mathcad file with these things?

-MFra-
21-Topaz II
(To:Cornel)

you can use "Writeprn (" Destination file "," Origin file ") 

File output.jpg

ttokoro
20-Turquoise
(To:Teddy)

image.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.png

ttokoro
20-Turquoise
(To:ttokoro)

image.pngimage.pngimage.pngimage.pngimage.pngimage.png

Top Tags