Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi all,
I am trying to find out the Fourier series of a half rectified sinusoidal wave for up to six terms. Amplitude= V volts and period of 2pi.
For B(n) the first term should be 0.5 then 0 afterwards. However, Mathcad is giving a very small number 10^-17 but not zero. Why is this ?
Second problem: When I try to integrate sin(t)*sin(nt), Mathcad should use the orthogonal trig identity to convert it into sin(1-n)t+sin(1-n)t or something along those lines. If this is not done Mathcad can't compute when n=1 because in B(n) it has n^2-1 in the denominator. This is a small problem that I can live with but the one above is a bigger one.
Solved! Go to Solution.
1) The 10^-17 are small numerical inaccuracies you always have to be aware of when using numerical calculations. Most software use the IEEE format to store real numbers and suffer from the very same problem in one way or another.
If you need exact results you have to use the symbolic evaluation.
2) Division by zero: Unfortunately the symbolic evaluation does not take in account the case n=1 when using the summation. Its able to evaluate A(1) and B(1), but not in a sum. You may call it a limitation or you may call it a bug. Here are a few more strange (and definitely wrong) results using the new symbolic in Prime 6:
If you are not in desperate need for a symbolic solution, you might use a pure numeric approach:
Prime 6 sheet attached
Hi,
Thanks for trying to help. Unfortunately that does not help since the pdf notes you have provided is using different techniques to analyse different frequencies in a signal.
My question is regarding Fourier series of this signal. For example, how can I find the Fourier series up to 6 terms of half rectified wave? I want to do that in Mathcad
1) The 10^-17 are small numerical inaccuracies you always have to be aware of when using numerical calculations. Most software use the IEEE format to store real numbers and suffer from the very same problem in one way or another.
If you need exact results you have to use the symbolic evaluation.
2) Division by zero: Unfortunately the symbolic evaluation does not take in account the case n=1 when using the summation. Its able to evaluate A(1) and B(1), but not in a sum. You may call it a limitation or you may call it a bug. Here are a few more strange (and definitely wrong) results using the new symbolic in Prime 6:
If you are not in desperate need for a symbolic solution, you might use a pure numeric approach:
Prime 6 sheet attached
Thank you for taking time out of your day and giving such a comprehensive response. I had a look at the file you provided it was good.
It seems that using symbolic arrow to find the expression for B(n) gives problems however; when this step is skipped and the symbolic arrow is used on just B(n) then it returns the correct 6X1 matrix with 1/2 or V/2 then 0,0,0,0.... which is the correct(refer to the the screenshot).
This is a bit disappointing I have to say but hey; mathcad is still the best in the market.
I am transitioning from Matlab so I am a bit of newbie when it comes to this.
You can get what you are looking for if you define A1 and B2 separately:
The same method fails however if I make the voltage V and additional argument of all functions 😞
Another method to deal with numerical problems, and especially where division by 0 poses a problem, is to use limits:
Success!
Luc