Help trying to solve exponential fourier series

Thread Starter

0Wafi0

Joined May 15, 2015
25
I followed the formulas we were given by the lecturers and I think I'm doing something wrong. I am trying to do a fourier series approximation of the function s(t)=1-e^(-5t) for the interval from 0 to 1.5. We were given a matlab code to test our term. As per the equations we were given by the lecturer I just needed to calculate the term Cn. But I think I did something wrong that I'm missing in trying to compute the integral to calculate the term Cn. The matlab script needs to inputs : the values of Cn and f0 which is the fundamental frequency. In this case the fundamental frequency is 2/3.
Cn is an array containing the various values of Cn for various nth harmonics between a certain interval x like -x<n<x. For the matlab input I tried a range
of about -800<n<800. n is an integer. the plot from matlab does not match the plot of the original function between the interval 0 to 1.5. So I reckon I'm calculating the Cn term wrong. I have attached the necessary details.

Apologies if I missed anything. Let me know if there is more details you'd like to know. But I just need to know if I'm doing something with the integral workings I attached here.
 

Attachments

Last edited:

Thread Starter

0Wafi0

Joined May 15, 2015
25
The n of Cn is actually from negative infinity to positive infinity. And those are the formulas the lecturers gave me. The matlab code provided cannot be opened. is a protected file with a p extension. may I remind you that I'm referring to exponential fourier series and not trigonometrical fourier series in which case n is from 1 to infinity. I provided my attempt at finding the actual Cn term which I will evaluate on matlab or do it manually to find an approximation of the initial signal. however I think I'm doing something wrong in the integral and that's where I needed help. If you're too lazy to open the screen shots I provided then don't even bother helping.

n represents the nth harmonic and it is an integer. so if I'm taking Cn from -3<n<3 , in this case, I have 7 terms. That's how the formulas I am given are to be interpreted.

Moderator's note: Rude language removed -please be polite at all times.
 
Last edited by a moderator:

MrAl

Joined Jun 17, 2014
11,342
Hello,

It looks like you had approached the problem correctly so did you try to prove the result of the integration in any way? The cn are related to the an and bn if you look that up, so you might try that to verify. It helps to be able to verify or disprove this stuff yourself too so that you can do it in the future where there is no one around to help. It's also interesting to do that.
 

Thread Starter

0Wafi0

Joined May 15, 2015
25
hey man thanks for your reply. Yes, I checked my answer with matlab. My lecturers provided a code in which you compute a set of values for Cn, arrange them in an array and punch them in the function along with the fundamental frequency. The only problem is that the output from the code gives me a graph that is quite different from the original function =( . So that's where I was stuck. I know it's wrong but I can't quite find what is wrong with it.
 

MrAl

Joined Jun 17, 2014
11,342
Hi again,

First, do you mean the Cn or do you really mean the Ck ?

Post a few of your values, say from 1 to 5 or something.
 

Thread Starter

0Wafi0

Joined May 15, 2015
25
Hi again,

First, do you mean the Cn or do you really mean the Ck ?

Post a few of your values, say from 1 to 5 or something.
I mean the Cn...the matlab code will compute various value of the term Ck for me.that's where I'm getting stuck =)
 

MrAl

Joined Jun 17, 2014
11,342
Hello,

Well ok then post some of the values you already got so we can compare. I suggested this before.
 

Thread Starter

0Wafi0

Joined May 15, 2015
25
In case you did not notice... they don't actually want to do any work by hand.
in case you didn't notice I posted a picture of my hand calculations. Please stop assuming things. This is the second time you assume I'm trying to make people do my work, but maybe it's you who likes to bash at people. I attempted this at least 6 times and I still can't get it to work. I posted a picture of my best attempt in the first post. Have a look at that 2.5 mb picture that you did not want to open if you want to see my hand calcs.
You said you had to input values, so that is why i asked for values.

Good luck with it.
We are to compute the Cn term. simplify it until we get a it to a form that is in terms of n. Input that term into matlab with a set of values and see what it outputs or graphs. but I think I'm doing something wrong with the integral. I posted up a picture that shows my attempt and all my workings. I tried this several times and for some reason I can't get it to work on matlab. I would compute each value by hand but it wouldn't be of great use for the excercise as it asks to find the Cn term and just test it with the code to see if it works. the code doesn't output any values. it justs outputs a graph.
 
Last edited:

Thread Starter

0Wafi0

Joined May 15, 2015
25
and since my uploaded attempt seems to be hard to open, my Cn term that I got out of the integral is : (exp(-7.5)-1)/(7.5+2*nj). from there you set a range of values say +800 to -800 punch it into matlab and see if it plots a good etimation of the graph. but somehow it doesn't match the original function. It is quite similar but it appears to be offset on the y axis a little bit. I can post up the graphs matlab outputs as well.
 

MrAl

Joined Jun 17, 2014
11,342
in case you didn't notice I posted a picture of my hand calculations. Please stop assuming things. This is the second time you assume I'm trying to make people do my work, but maybe it's you who likes to bash at people. I attempted this at least 6 times and I still can't get it to work. I posted a picture of my best attempt in the first post. Have a look at that 2.5 mb picture that you did not want to open if you want to see my hand calcs.

We are to compute the Cn term. simplify it until we get a it to a form that is in terms of n. Input that term into matlab with a set of values and see what it outputs or graphs. but I think I'm doing something wrong with the integral. I posted up a picture that shows my attempt and all my workings. I tried this several times and for some reason I can't get it to work on matlab. I would compute each value by hand but it wouldn't be of great use for the excercise as it asks to find the Cn term and just test it with the code to see if it works. the code doesn't output any values. it justs outputs a graph.
Hi,

For some reason you insist to not do what i ask. At least post ONE calculation with ONE value of 'n' where n is a prime number like 11. If you get a result like 3+2j and i get 5+17j then i would suspect you did something wrong. If we both get the same result, then it might be more likely that something else is wrong that is beyond your control. It could be that the software is looking for a different input form. I dont ask these question for my health, only to try to help :) It is also hard to read other people's writing sometimes so if you type it out that would be better.

The other guy is probably talking about your 2.5MB file. Files like that never need to be that large. You can show the same information with less than a 250kB file and that makes it more easy and more economical for some people to download because they pay by the bandwidth used each month.
 

Thread Starter

0Wafi0

Joined May 15, 2015
25
Hi,

For some reason you insist to not do what i ask. At least post ONE calculation with ONE value of 'n' where n is a prime number like 11. If you get a result like 3+2j and i get 5+17j then i would suspect you did something wrong. If we both get the same result, then it might be more likely that something else is wrong that is beyond your control. It could be that the software is looking for a different input form. I dont ask these question for my health, only to try to help :) It is also hard to read other people's writing sometimes so if you type it out that would be better.

The other guy is probably talking about your 2.5MB file. Files like that never need to be that large. You can show the same information with less than a 250kB file and that makes it more easy and more economical for some people to download because they pay by the bandwidth used each month.
heyyy man sorry I didn't get what you were trying to ask sorry man. I got distracted. plus someone really bashed at me for no reason saying that I had no idea what I was doing and that I should read the "fucking textbook". so that's why my perspective became very acute. I understand my file might have been too big but that was no reason for assuming I didn't do any work and acting like I was some of those douchebag students...

Anyhow apologies for that! I found out what was wrong. Basically my workings were on point is just some adjustments needed to be done on matlab to use that stupid code. I'm not the only one who was banging his head against it.

best regards,
Again thanks for trying to help!!!!
 
Top