Question

3. Consider the function f(t) = π2 , with f(t) = f(t +2r). 0<t<π (a) Sketch f(t) by hand for-3r < t < 3T. (b) Determine the

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

3テー th2 ーオ 2七.an&q dt -., h.3 n-thi ん 3 2.%Matlab code for Fourier Series clear all close all %All time values X-linspace (-pi, pi,1001); %Loop for creating the functiPlotting of Actual data and Fourier sum for 4 terms 12 -Actual data Fourier sum 10 Published with MATLAB R2018a

%Matlab code for Fourier Series
clear all
close all
%All time values
X=linspace(-pi,pi,1001);
%Loop for creating the function
for i=1:length(X)
    if X(i)>=-pi && X(i)<0
        zz(i)=(X(i)).^2;
    else
        zz(i)=pi^2;
    end
end
figure(1)
%Plotting the function
hold on
plot(X,zz)
xlabel('x')
ylabel('f(x)')
title('Plotting of Actual data and Fourier sum for 4 terms')

%fourier series
a0=4*pi^2/3;

an=@(n) (2./(n.^2)).*cos(n*pi);
bn=@(n) pi./n+(2./(n.^3*pi)).*(1-cos(n.*pi));

s=a0/2;
for nn=1:4
    s=s+an(nn).*cos(nn.*X)+bn(nn).*sin(nn.*X);
end

plot(X,s)
legend('Actual data','Fourier sum ')
grid on
%%%%%%%%%%%%%% End of Code %%%%%%%%%%%

Add a comment
Know the answer?
Add Answer to:
3. Consider the function f(t) = ' π2 , with f(t) = f(t +2r). 0<t<π (a)...
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