Question

4. Using the Fourier series coefficients {ak} obtained, construct the following signal N(t)>akekwot k=-N where ak is the kthcould you please solve this problem using Matlab

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The following example is considered to demonstrate in MATLAB.

x(t) =1 for 0<=t<=1, 0 otherwise and T=2

MATLAB code:

clc;clear all;close all;
T=2%Fundamnetal period
w0=2*pi/T;%Angular frequency
t=0:T/500:T;%time range
x=1.*(t>=0 &t<=1)%Define square wave
figure;
for i=1:1:4
M=[10 20 30 40];
N=M(i);
%calculate ak-Fourier series coefficients
k=0;
for n=-N:1:N
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T
n=-N:1:N

%Fourier series approximation
k=0;
for t=0:T/500:T
k=k+1;
xN(k)=sum(a.*(exp(j*n*w0*t)));
end
t=0:T/500:T
subplot(2,2,i)
plot(t,xN,'g','LineWidth',3,t,x,'r','LineWidth',3);grid;
title(sprintf('Fourier seies approximation for N=%d',N))
xlabel('t')
legend('xN(t)','x(t)')

end

Plot:

Fourier seies approximation for N=10 Fourier seies approximation for N=20 1.4 xN(t) 1.2 XN(t) X(t) X(t) 0.6 0.4 0 0.2 0 0.5 1

Add a comment
Know the answer?
Add Answer to:
could you please solve this problem using Matlab 4. Using the Fourier series coefficients {ak} obtained,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT