any idea how can i compute this formula in matlab?

how can i compute exponential complex Fourier series in Matlab?
where
T = 2.25;
f0 = 1/T;
n = (-5:5).';
t = linspace(-2.75, T,samples+1);
t = t(1:end-1);
s((-2.75) <= t & t < (-0.25)) = 1;
s((-0.25) <= t & t < (2.25)) = -1;
n = 5;
c0 = (1/T) * sum(s);
cn = (1/T) * s * exp(-1j*2*pi*f0*n*t).';
thanks

7 Comments

Why do you think that what you did was incorrect? Why do you think there is a problem in that?
I didn't say that :). i just said how to compute the above formula. because it should be from -inf:inf and that cannot be done in for loop. so maybe there is a way to do it.
@ocsse: Are you going to stop deleting the contents of your questions after answers have been given? Note, that the nature of this forum is to share solutions in public. Therefore it is disliked, if the questions are removed after someone took the time to provide an answer.
ocsse
ocsse on 26 Mar 2018
Edited: ocsse on 26 Mar 2018
Hi Jan, apologies for that. after contacting my tutors, they said that it's okay to use MathWorks community. however, sometimes i don't want others having the same unit to look at the code. especially when i post quite long code. that's why i deleted some of the posts, because it was a long piece of code. Thanks
Jan
Jan on 26 Mar 2018
Edited: Jan on 26 Mar 2018
@ocsse: Thanks for the explanation. I'm glad, that your tutors understand, that the forum will have a positive effect for learning Matlab. Now let me be your tutor in the forum and tell you, that removing the contents of question reduces the chance, that experiences members of the forum care about your questions. Therefore I asked and did not really get the answer yet.
ocsse: we do not do private consulting in this resource. If you need to post something that other people in your course should not see, then you should be hiring a private consultant. We only work in public here.
My bad. No more deleting content.

Answers (0)

This question is closed.

Asked:

on 26 Mar 2018

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!