-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw.tex
135 lines (98 loc) · 3.75 KB
/
hw.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
%% LyX 2.2.2 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\renewcommand{\ttdefault}{cmtt}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=1cm,rmargin=1cm}
\setlength{\parskip}{\smallskipamount}
\setlength{\parindent}{0pt}
\usepackage{float}
\usepackage{units}
\usepackage{graphicx}
\usepackage{esint}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{ME 585 Special Topics in Mech. Eng., Fall 2015}
\chead{C. Ça\u{g}r\i{} ÖZKAN}
\rhead{Assignment 2}
\rfoot{Yeditepe University}
\cfoot{\thepage}
\lfoot{Mechanical Engineering}
\usepackage{tikz}
\usepackage{pgfplots}
% recommended as of Pgfplots 1.3:
\pgfplotsset{compat=newest}
\makeatother
\usepackage{babel}
\usepackage{listings}
\renewcommand{\lstlistingname}{Listing}
\begin{document}
\paragraph*{{\large{}Question Modification:}}
Since ID=XXXXXXX9X03 the coefficients are $a=3;\:b=0;\:c=9$
Therefore;
$y=f(t)=3t^{2}+9$ in interval of $0,1$
\section*{{\large{}Solution:}}
$T=1\rightarrow\omega=\nicefrac{2\pi}{T}=2\pi$
$a_{0}=\frac{2}{1}\int_{0}^{1}f(t)dt=2\int_{0}^{1}(3t^{2}+9)dt=2\left[t^{3}+9t\right]_{0}^{1}=20$
$a_{n}=\frac{2}{1}\int_{0}^{1}(3t^{2}+9)cos(n\omega t)$
$b_{n}=\frac{2}{1}\int_{0}^{1}(3t^{2}+9)sin(n\omega t)$
Maxima is used to integrate the $f(t)*cos(2\pi n)$ and $f(t)*sin(2\pi n)$
to get cosine and sine compliance. The commands are listed below.
\begin{lstlisting}[basicstyle={\small\ttfamily}]
ratsimp(integrate((3*t^2+9)*cos(w*t*n),t,0,1));
ratsimp(integrate((3*t^2+9)*sin(w*t*n),t,0,1));
\end{lstlisting}
\[
a_{n}=2\times\frac{6\cdot n\cdot w\cdot\mathrm{cos}\left(n\cdot w\right)+\left(12\cdot{{n}^{2}}\cdot{{w}^{2}}-6\right)\cdot\mathrm{sin}\left(n\cdot w\right)}{{{n}^{3}}\cdot{{w}^{3}}}
\]
\[
b_{n}=2\times\frac{-6+9\cdot{{n}^{2}}\cdot{{w}^{2}}+\left(6-12\cdot{{n}^{2}}\cdot{{w}^{2}}\right)\cdot\mathrm{cos}\left(n\cdot w\right)+6\cdot n\cdot w\cdot\mathrm{sin}\left(n\cdot w\right)}{{{n}^{3}}\cdot{{w}^{3}}}
\]
Therefore;
\[
y(t)=\frac{a_{0}}{2}+\sum_{n=1}^{100}a_{n}cos(\omega nt)+b_{n}sin(\omega nt)
\]
To simplify the output; $\pi$ is set to 3.14 therefore $\omega=6.28$
since $\omega=2\pi$
\[
y(t)=\frac{20}{2}+\sum_{n=1}^{100}a_{n}cos(6.28nt)+b_{n}sin(6.28nt)
\]
\begin{lstlisting}[numbers=left,numberstyle={\scriptsize},basicstyle={\small\ttfamily},breaklines=true]
sum((2*6*n*(2*3.14)*cos(n*(2*3.14))+(12*n^2*(2*3.14)^2-6)*sin(n*(2*3.14)))/(n^3*(2*3.14)^3)*cos((2*3.14)*n*t)+2*(-6+9*n^2*(2*3.14)^2+(6-12*n^2*(2*3.14)^2)*cos(n*(2*3.14))+6*n*(2*3.14)*sin(n*(2*3.14)))/(n^3*(2*3.14)^3)*sin((2*3.14)*t*n), n, 1, 100), simpsum;
\end{lstlisting}
\begin{figure}[H]
\begin{centering}
\includegraphics[width=0.5\textwidth]{../YuksekLisans/muzik/grafik1aa}
\par\end{centering}
\caption{f(t) vs. Fourier Series}
\end{figure}
Following Octave code is used to determine intensity of each sine/cosine
component for the frequency from $\pi$ to $10\pi$
\begin{lstlisting}[numbers=left,numberstyle={\scriptsize},basicstyle={\small\ttfamily}]
function ycos=an(n)
ycos=2*(6*n*2*pi*cos(n*2*pi)+(12*n^2*(2*pi)^2-6)*sin(n*2*pi))/(n^3*(2*pi)^3);
endfunction
function ysin=bn(n)
ysin=2*(-6+9*n^2*(2*pi)^2+(6-12*n^2*(2*pi)^2)*cos(n*(2*pi))+6*n*(2*pi)*...
sin(n*(2*pi)))/(n^3*(2*pi)^3);
endfunction
for i=1:1:10
m(i,1)=sqrt(an(i)^2+bn(i)^2);
endfor
f1 = fopen('~/YuksekLisans/muzik/hw3_m.dat','w');
for i = 1:length(m)
fprintf(f1,'%d\n',m(i));
end
fclose(f1);
\end{lstlisting}
\begin{figure}
\begin{centering}
\includegraphics[width=0.5\textwidth]{../YuksekLisans/muzik/22}
\par\end{centering}
\caption{Intensity vs. frequency}
\end{figure}
\end{document}