Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Task 1: Write an m-file that evalutates a Fourier series Write an m-file that ta

ID: 2268519 • Letter: T

Question

Task 1: Write an m-file that evalutates a Fourier series Write an m-file that takes a set of Fourier series coefficients, a fundamental frequency, and a vector of output times, and computes the truncated Fourier series evaluated at these times. The declaration and help for the m-file might be function fn my fs (Dn, omega,t) = fn my fs (Dn, omegao, t) = 8 Evaluates the truncated Fourier Series at times t 8 Dn vector of Fourier series coefficients assumed to run from-N:N, where length (Dn) is 2N+1 8 omega0 fundamental frequency --vect rf times for evaluation fn -truncated Fourier series evaluated at t The output of the m-file should be The length of the vector Dn should be 2N +1. You will need to calculate N from the length of n.

Explanation / Answer

clear %CLEAR ALL OLD VARIABLES

clc %CLEAR THE SCREEN

t=linspace(-3,3,200); % setting the values of time

y=0;

for n=1:2:50
  
y=y+((2/(n*pi))*sin(n*pi*t)); %DEFINE THE EQUATION
  
  
if n==1
  
y1=y+.5;
  
subplot(2,2,1);
  
plot(t,y1,'r') %PLOT THE IST HARMONIC IN THE CORNER 1
  
grid on
  
title('1st harmonic') %PUT THE TITLE OF THE GRAPH
  
xlabel('t(sec)') %PUT THE TITLE OF X AXIS
  
ylabel('f(t)')%PUT THE TITLE OF Y AXIS
end
  
if n==3
  
y1=y+.5;
  
subplot(2,2,2);
  
plot(t,y1,'b')
  
grid on
  
title('3rd harmonic')
  
xlabel('t(sec)')
  
ylabel('f(t)')
end
  
if n==15
  
y1=y+.5;

subplot(2,2,3);
  
plot(t,y1)
  
grid on
  
title('21 harmonic')
  
xlabel('t(sec)')
  
ylabel('f(t)')
end
  
if n==49
  
y1=y+.5;
  
subplot(2,2,4);
  
plot(t,y1)
  
grid on

title('49 harmonic')

xlabel('t(sec)')
  
ylabel('f(t)')

end
  
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote