




%Matlab code for Fourier Series
clear all
close all
%All time values
X=linspace(-1,1,1001);
%Loop for creating the function
for i=1:length(X)
if X(i)>=-1 && X(i)<0
zz(i)=0;
else
zz(i)=1-(X(i)).^2;
end
end
figure(1)
%Plotting the function
plot(X,zz)
xlabel('x')
ylabel('f(x)')
title('Plotting of Actual data')
a1=X(1); b1=X(end);
l=(b1-a1)/2;
%Fourier series of the function for finding a and b
coefficients
for j=1:200
ss1=zz.*cos(j*pi*X/l);
%all a values of the Fourier series
aa(j)=(1/l)*trapz(X,ss1);
ss2=zz.*sin(j*pi*X/l);
%all b values of the Fourier series
bb(j)=(1/l)*trapz(X,ss2);
end
%a0 value of Fourier series
aa0=(1/l)*trapz(X,zz);
X=linspace(-3,3,6001);
s=aa0/2;
%all an and bn terms
fprintf('Printing few terms for Fourier series\n')
for i=1:10
fprintf('\tThe value of a%d=%f and b%d=%f.
\n\n',i,aa(i),i,bb(i))
end
%Fourier series of the function
for i=1:200
s=s+bb(i)*sin(i*pi*X/l)+aa(i)*cos(i*pi*X/l);
if i==20
figure(2)
plot(X,s)
xlabel('time')
ylabel('f(t)')
title('Fourier series of
given function for 20 terms')
elseif i==200
figure(3)
plot(X,s)
xlabel('time')
ylabel('f(t)')
title('Fourier series of
given function for 200 terms')
end
end
%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%
Using MATLAB (a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs...
(a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs1. T-2 (b) Using MATLAB, plot the first 20 terms and the first 200 terms of the Fourier series in the interval -3< r<3, In order to do this, the r-interval should be divided into 6001 cqually spaced points by making use of the MATLAB command linspace.
(a) Find the Fourier series for 25 { O if 1 r
(a) Find the Fourier series for 25 { O if 1 r<O 1-2 if 0<H<1 f(x) defined on the interval -1<rs1. T-2 (b) Using MATLAB, plot the first 20 terms and the first 200 terms of the Fourier series in the interval -3< r<3, In order to do this, the r-interval should be divided into 6001 cqually spaced points by making use of the MATLAB command linspace.
(a) Find the Fourier series for 25 { O if 1 r
2. Using the MATLAB "integral" command, numerically determine the Fourier Cosine series of the following function. Assume each case has an even extension (b,-0) Last Name N-Z: f= 2xcos (Vx+4), 0<x<3 (Hint: after extension L-3) Have your code plot both the analytical function (as a red line) and the numerical Fourier series (in blue circles -spaced appropriately). Use the Legend command to identify the two items. It is suggested to use a series with 15 terms.
1. (a) Evaluate the Fourier coefficients a, an, ba for the function defined as f)-2 cos() for-π/2 s sn2 and zero else over the period of 2T, do NOT use MATLAB or a calculator for integrations. All the steps should be shown. Write a few terms of the Fourier series expansion Plot 2 or 3 cycles of the Fourier series using MATLAB and verify whether the plot matches the given waveform Find Co and Cn and plot the amplitude spectrum...
Find a Fourier series representation in the form x(t)-xp ol + 〉 2 KI k || cos(kat+ X | k |) of a. に! the impulse train and plot the spectrum of the series through the 5th harmonic. Write out the first five terms of the Fourier series of x(t) b. Now, find a Fourier series representation in the form x(t)=X[0] +Σ2k[k] cos(kay + X[k]) of the following (periodic) square wave に! 0 To To/2 To and plot the spectrum...
0< x <1 Consider the function f(x) defined on (0,2), f(x)- (a) Fourier Sine series: Use symmetry on the half interval 0 < x <2 to explain why b2 = b4 = … = 0. Then derive a general expression for the non-zero coefficients in the Sine series (bi, b3, bs, ...) and plot the first term in the sine series on top of a graph of f(x)
2. Find the Fourier series for the periodic function defined by if 0
PLZ shows you Matlab Code
X(t) 2 2 46 1. compute the Fourier Series coefficients, ck for the signal x(t) 2. plot magnitude of c and the phase of ck in separate plots (use subplot command) plot the Fourier Series coefficients for the square wave signal: ck(12/9) sinc(2"k/3)
Find the Fourier series off on the given interval. <x<0 OsX< F(x) = Give the number to which the Fourier series converges at a point of discontinuity of I. (if is continuous on the given interval, enter CONTINUOUS.) Let A = PDP-1 and P and D as shown below. Compute A Let A=PDP-1 and P and D A=1901 (Simplify your answers.) Use the factorization A = PDP-1 to compute Ak, where k represents an arbitrary integer. [x-» :)+(1:10:1 2:] Diagonalize...
find fourier series of
Question 3 Find Fourier series of f(x)= 0 if -55x<0 and f(x) = 1 if 0<x<5 which f(x) is defined on (-5,5).