Assignment For Machine Design 2018 - 2020 Batch: 1 Sin Cos 0 Sin Cos 0

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

ASSIGNMENT FOR MACHINE DESIGN 2018 – 2020 BATCH

Problem 5

Determine the Fourier series for the graph shown and plot it in MATLAB

𝒕+𝝅
, −𝝅 ≤ 𝒕 ≤ 𝟎
𝝅
𝒙(𝒕) = { 𝝅 − 𝒕
, 𝝅≤𝒕≤𝟎
𝝅
𝟐 𝝉
an = ∫𝟎 𝒙(𝒕)𝒄𝒐𝒔 𝒏𝒕𝒅𝒕
𝝉

2 0 𝑡+𝜋 𝜋
𝜋−𝑡
= ∫ cos 𝑛𝑡 𝑑𝑡 + ∫ cos 𝑛𝑡 𝑑𝑡
2𝜋 −𝜋 𝜋 0 𝜋
0 0 𝜋 𝜋
2 𝑡 𝑡
= [∫ cos 𝑛𝑡 𝑑𝑡 + ∫ cos 𝑛𝑡 𝑑𝑡 + ∫ cos 𝑛𝑡 𝑑𝑡 − ∫ cos 𝑛𝑡 𝑑𝑡]
2𝜋 −𝜋 𝜋 −𝜋 0 0 𝜋

1 𝑡 sin 𝑛 𝑡 cos 𝑛𝑡 0 𝑡 sin 𝑛 𝑡 cos 𝑛𝑡 𝜋


= 2 [( 𝑛 + ) + ( 𝑛 + 𝑛2 )0 ]
𝜋 𝑛2 −𝜋
𝑛
1 2 2(−1)
= 2 [ 2− ]
𝜋 𝑛 𝑛2
𝟐
an = 𝟐 [𝟏 − 𝐜𝐨𝐬 𝒏𝝅]
𝒏𝟐 𝝅

𝟐 𝝅
bn = ∫ 𝒙(𝒕)𝒔𝒊𝒏 𝒏𝒕𝒅𝒕
𝝉 −𝝅

2 0 𝑡+𝜋 𝜋
𝜋−𝑡
= ∫ sin 𝑛𝑡 𝑑𝑡 + ∫ sin 𝑛𝑡 𝑑𝑡
2𝜋 −𝜋 𝜋 0 𝜋
0 0 𝜋 𝜋
2 𝑡 𝑡
= [∫ sin 𝑛𝑡 𝑑𝑡 + ∫ sin 𝑛𝑡 𝑑𝑡 + ∫ sin 𝑛𝑡 𝑑𝑡 − ∫ sin 𝑛𝑡 𝑑𝑡]
2𝜋 −𝜋 𝜋 −𝜋 0 0 𝜋

1 −𝑡 cos 𝑛 𝑡 sin 𝑛𝑡 0 −𝑡 cos 𝑛 𝑡 sin 𝑛𝑡 𝜋


= [( + ) + ( + ) ]
𝜋2 𝑛 𝑛2 −𝜋 𝑛 𝑛2 0
bn =0
𝟐 𝝅
a0 = ∫−𝝅 𝒙(𝒕)𝒅𝒕
𝝉

2 0 𝒕+𝝅 𝜋 𝝅−𝒕
= [∫−𝜋 𝑑𝑡 + ∫0 𝑑𝑡]
2𝜋 𝝅 𝝅

0 𝜋
1 𝑡2 −𝑡 2
= [( + 𝑡) +( + 𝑡) ]
𝜋 2𝜋 −𝜋 2𝜋 0

1 −𝜋 𝜋
= [ + 2𝜋 − ]
𝜋 2 2

a0 = 1
𝒂𝟎
x(𝒕) = + ∑∞
𝒏=𝟏(𝒂𝒏 𝐜𝐨𝐬 𝒏𝒕 + 𝒃𝒏 𝐬𝐢𝐧 𝒏𝒕)
𝟐

𝟏 𝟐
x(𝒕) = + ∑∞
𝒏=𝟏 ( 𝟐 [𝟏 − 𝐜𝐨𝐬 𝒏𝝅] 𝐜𝐨𝐬 𝒏𝒕)
𝟐 𝒏𝟐 𝝅

MATLAB Program-
clear all;
clc;
sum1=0;
t=linspace(-pi,4*pi,361);
for n=1:1:1000
sum1=sum1+(2/(pi*n)^2)*(1-cos(n*pi))*cos(n*t);
end
sum1=sum1+.5;
plot(t,sum1,'r');
xlabel('t');
ylabel('x(t)');
grid on;
Output

Figure 1 MATLAB output


Problem 6

Determine the Fourier series for the graph shown and plot it in MATLAB

𝒕
x(t) = , 𝟎 ≤ 𝒕 ≤ 𝟐𝝅
𝟐𝝅
𝟐 𝝉
an = 𝝉 ∫𝟎 𝒙(𝒕) 𝐜𝐨𝐬 𝒏𝒕 𝒅𝒕
2 2𝜋 𝑡
= ∫ cos 𝑛𝑡 𝑑𝑡
2𝜋 0 2𝜋
1 𝑡 sin 𝑛𝑡 1 cos 𝑛𝑡 2𝜋
= [( ) + ]
𝜋 2𝜋 𝑛 2𝜋 𝑛2 0

an = 0
𝟐 𝝉
bn= 𝝉 ∫𝟎 𝒙(𝒕) 𝒔𝒊𝒏 𝒏𝒕 𝒅𝒕

2 2𝜋 𝑡
= ∫ sin 𝑛𝑡 𝑑𝑡
2𝜋 0 2𝜋
1 −𝑡 cos 𝑛𝑡 1 sin 𝑛𝑡 2𝜋
= [( ) + ]
𝜋 2𝜋 𝑛 2𝜋 𝑛2 0

−𝟏
bn =
𝒏𝝅
𝟐 𝝉
a0 = ∫ 𝒙(𝒕)𝒅𝒕
𝝉 𝟎

2 2𝜋 𝑡
= ∫ 𝑑𝑡
2𝜋 0 2𝜋

a0 = 1
𝒂𝟎
x(𝒕) = + ∑∞
𝒏=𝟏(𝒂𝒏 𝐜𝐨𝐬 𝒏𝒕 + 𝒃𝒏 𝐬𝐢𝐧 𝒏𝒕)
𝟐

𝟏 −𝟏
∴ x(t)= + ∑∞
𝒏=𝟏 ( 𝐬𝐢𝐧 𝐧𝒕)
𝟐 𝝅𝒏
MATLAB Program-
clear all;
clc;
sum1=0;
t=linspace(-2*pi,4*pi,361);
for n=1:1:1000
sum1=sum1-(1/(pi*n))*sin(n*t);
end
sum1=sum1+.5;
plot(t,sum1,'r');
xlabel('t');
ylabel('x(t)');
grid on;

Output

Figure 2 MATLAB output

You might also like