Swordrock's Blog

Just another WordPress.com site

Fourier Analysis

Fourier Analysis

Hi !

Today i begin to share a new area , a genius theory from Joseph Fourier. Fourier says that any engineering signals can be represented as a series sum of sine , even square and triangle waves .

Sine waves have many interesting properties , many natural operations deal with a set of differing frequency sine waves as if they were processed individually .

We will learn the technique of expressing waves in terms of sine,this will allow us to use them as we want them to be.

Suppose your signal has noise at a particular frequency (may be 30-40 HZ) , we can pick apart the data to its constituent parts,remove the noise frequency , then stictch the rest back together to get a signal without the noise . This kind of notch filtering is very useful in audio signals .

In image processing,it is possible to look at an image and distil it down to small blocks , then look at each of the line;

now we can treat each line as a 1D signal,it’s then easy to see how you would apply the same techniques to the data that you would with any other signal . Let’s begin our theoric expansions.

square wave     

sine wave

Trigonometric Fourier Series

What it means to be periodic ? When we use periodic for a signal , we say that you get the same samples in the same intervals ;

f (t) = f (t+nT) means that for every period T .

Any periodic function of frequency wo can be expressed as an infinite sum of sine and cosine functions that are integral multiples of wo.


f(t) = a0 + a1cos(w0) + b1sin (w0)+…..

in this equation,we can take (a0) as DC part of our signal,which is linear and not wavy .(a0) is also called the average value of f(t) (remember the average value of sinusoids are zero)

Also ;

w0 = 2*pi/T; which is called “fundamental frequency in radians per second”

Another important term is harmonic; The sin(nwot) or cos(nwot) is called nth harmonic of f(t).


(an) and (bn) are called “Fourier Coeficcients .” Our work is to find these coefficients to transform our time domain signal through frequency domain.

so ,let’s ask; Why we need Fourier Series of a function,why function itself is not enough for us ?

The fourier series of a periodic function  f(t) is a representation that analyzes f(t) into a DC component and AC component comprising an infinite series of harmonic sinusoids.


Your fourier series must contain these conditions ;

1).f(t) is single-valued everywhere in the domain

2).f(t) has a finite number of finite discontinuities in any one period .

3).f(t) has a finite number of maxima and minima in any one period .

As i say earlier , the process of determining the coefficients is called “Fourier Analysis” .

Let’s translate what we say into math !

I will share some trigonometric properties in the chart below , It tells you how to calculate ao,an and bn values for analysis .You will see that average values of sinusoids are zero in an interval.


Here is a useful Fourier Analysis video , that tells what it means to transform functions , A must see 3 video  :

Fourier transform-1

Fourier tranform-2

Fourier Transform-3


See al videos after reading my paper , See you next lesson

Take Care!



Ekim 31, 2010 Posted by | Circuit Analysis | , , , | Yorum bırakın

C++ 2

Hi ,

Last lesson i share some basic knowledge and code analysing , designing and writing process . Every code brings a solution to problem/problems , so i tell how to attend to solution . I also tell why object using and object mesaggings are important in C++ .

Today i tell you  why C++ is better than C , declaration and deefinition basics , syntax usage in C++ , funcion variable definiton,including headers  . As lesson ends , we get the knowledge of writing our first code : radix converter

Why C++ is better ?

#improved productivity

#closed lots of holes in C

#the need for the preprocessor has been eliminated for value substitution and macros . (it was difficult to find lots of bugs before.)

#a feature called “namespace”  improves control of names .

#%10 faster program speed compared to C

Difference between declaration and definitions

A declaration introduces a name-an identifier-to the compiler . It tells the compiler “This function or this variable exists somewhere,and there how it is .”

A definition says “make this variable here or make this function here.”

It allocates storage for the name .

You can declare a variable or a fuınction wherever you want but only one definiton (this is called OOD rule) is allowed in C and C++ .

Function declaration syntax

İnt func1 (int,int)  // takes two arguments as integer

The first keyword is the return value : int

The arguments are enclosed by parenthesis

The semicolon tells the end of the statement , it tells the compiler “this is the end of this function”

We can declare func1() in a different way but with the same meaning :

İnt func1 (int length,int height)

Function definiton

İnt func1 (int length,int height)  {}

There is no semicolon but the  braces .

Variable declaration syntax

Tells the compiler what a variable looks like . it says “i know you havent seen it before but i will use it in somewhere. ”

İnt a ;

Including Headers

There is lots of functions and variables in the libraries .

To save work , C and C++ use files called “header file”

A header file contains external declarations .

It has a filename called headerfile.h

To include header file we use  :

#include <header>

We can use file name in double quotes like :

#include “iostream.h”

They are old tradidional versions , but now for C++ , you can use them like :

#include <iostream>

So  ;

#include <stdio.h>

#include <stdlib.h>


#include <cstdio>

#include <cstdlib>

// The iostream package automatically defines a variable (an object)  called cout that accepts all data bound for standart output .

// to send the data to standart output , we use the operator  << (bitwise left shift), it means “send to.” Cout  is hort of “console output” .

Cout << “hey , what’s up man ? ”<<

//namespace  : each set of C++ definitions in a libray or program is wrapped in a namespace . This keyword tells the compiler that i want to use definitons and/or declarations in this namespace .

Using namespace std ; // this means that you want to expose all the elements from the namespace called “std” .

Now i will tell an important note , when we use C programming language,we add header file to the program with “.h”  . But in C++ , you dont need to use it like that . There is a relationship between them .

#include <iostream.h>

Means now

#include <iostream>

using namespace std ;

Program Structure

When you begin to write code , you write primary code in main () .

As i tell earlier , you declare a function like that :

İnt func1 () {

//function code here


Main is always a function and it returns a value “int” .

Inside a character array , you can insert special characters for example

\n means newline

\t means tab


\b backsapce

Now let s write our first program :

Eg :


// C02 hello world program

e.g :

#include <iostream> 

using namespace std ;

int main ()


cout << “hello,world i am ”

<< 8 << ” Today!” << endl ;      system (“pause”);


As you see , we say hello to world , we only need iostream header and we get an output from it  .


Now we will see another stream features of iostream  :

Eg2 :


// CO2 : Stream.cpp

// more stream features on iostream

//iostream manipulators for converting numbers

#include <iostream>

using namespace std ;

int main () {

// specifying formats with manipulators

cout << “a number in decimal :”

<< dec << 15 << endl ;

cout << “in octal :”<<oct <<15<<endl ;

cout <<“in hex : “<< hex<< 15 << endl ;

cout <<“a floating point number : ” <<3.415698<< endl ;

cout << “non-printing char (escape): ” << char(27)<< endl ;   //any character can be sent to cout object using char (ascii code)

system (“pause”);



These code will work like that figure when you compile and run  :

I want everybody first learn “cout” object usage good enough , so let’s do another example on that



Character array concatenation

E.g  :

#include <iostream>

using namespace std;

int main() {

cout << “This is far too long to put on a ”

“single line but it can be broken up with ”

“no ill effects\nas long as there is no ”

“punctuation separating adjacent character ”


System (“pause”) ;



These code will also work like that :


Here is a video about OOP :

So useful , must SEE !


Thats all for today , thanks for reading , See you .

Ekim 30, 2010 Posted by | C/C++ programming | , , , | Yorum bırakın