text:
by Placement Papers
Java FAQs http://javabynataraj.blogspot.com 1 Java Interview Questions1)Why pointeres are eliminated from java.?Ans) 1.Pointers lead to confusion for a programmer.2. Pointers may crash a program easily, for example , when we add two pointers, the program crashersimmediately.3. Pointers break security. Using pointers, harmful programs like Virus and other hacking programs canbe developed. Because of the above reasons, pointers have been eliminated from java.2) What is the difference between a function and a method.?Ans). A method is a function that is written in a class. We do not have functions in java; instead wehave methods. This means whenever a function is written in java,it should be written inside the classonly. But if we take C++, we can write the funtions inside as well as outside the class . So in C++, theyare called member funcitons and not methods.3) Which part of JVM will allocate the memory for a java program.?Ans). Class loader subsystem of JVM will allocate the necessary memory needed by the java program.4). Which algorithm is used by garbage collector to remove the unused variables orobjects from memory.?Ans). Garbage collector uses many algorithems but the most commonly used algorithm is mark andsweep.5). How can you call the garbage collector.?Ans). Garbage collector is automatically invoked when the program is being run. It can be also calledby calling gc() method of Runtime class or System class in Java.6) What is JIT Compiler ?Ans). JIT compiler is the part of JVM which increases the speed of execution of a Java program.7)What is an API document ?Ans). An API document is a .html file that contains description of all the features of a softwar, aproduct, or a technology. API document is helpful for the user to understand how to use the software ortechnology.8) What is the difference between #include and import statement.? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 2Ans). #include directive makes the compiler go to the C/C++ standard library and copy the code fromthe header files into the program. As a result, the program size increases, thus wasting memory andprocssor’s time.import statement makes the JVM go to the Java standard library, execute the code there , and substitutethe result into the program. Here, no code is copied and hence no waste of memory or processor’stime.so import is an efficient mechanism than #include.9)What is the difference between print( ) and println( ) method ?Ans). Both methods are used to display the results on the monitor . print( ) method displays the resultand then retains the cursor in the same line, next to the end of the result. println( ) displays the result andthen throws the cursor to the next line.10)What happens if String args[] is not written in main( ) method ?Ans). When main( ) method is written without String args[] as: Public static void main( ) The code will compile but JVM cannot run the code beause it cannot recognize the main( ) as themethod from were it should start execution of the Java program. Remember JVM always looks for main() method with string type array as parameter.11) What is the difference between float and double?Ans). Float can represent up to 7 digits accurately after decimal point, where as double can represent upto 15 digits accurately after decimal point.12)What is a Unicode system ?Ans). Unicode system is an encoding standard that provides a unique number for every character, nomatter what the platform, program, orlanguage is. Unicode uses 2 bytes to represent a single character.13) How are positive and negative numbers represented internally ?Ans). Positive numbers are represented in binary using 1’s complement notation and negative numbersare represented by using 2’s complement notation.14) What is the difference between >> and >>> ?Ans). Both bitwise right shift operator( >> ) and bitwise zero fill right shift operator( >>> ) are used toshift the bits towards right. The difference is that >> will protect the sign bit whereas the >>> operatorwill not protect the sign bit. It always fills 0 in the sign bit.15) What are control statements ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 3Ans). Control statements are the statements which alter the flow of execution and provide better controlto the programmer on the flow of execution. They are useful to write better and complex programs.16) Out of do..while and while - - which loop is efficient ?Ans). In a do..while loop, the statements are executed without testing the condition , the first time. Fromthe second time only the condition is observed. This means that the programmer does not have controlright from the beginning of its execution. In a while loop, the condition is tested first and then only thestatements are executed. This means it provides better control right from the beginnig. Hence, while loopis move efficient than do.. while loop.17) What is a collection ?Ans). A collection represents a group of elements like integer values or objects. Examples forcollections are arrays and java.util_classes (stack, LinkedList, ;Vector, etc).18)Why goto statements are not available in Java ?Ans). Goto statements lead to confusion for a programmer. Especially in a large program, if severalgoto statements are used, the programmer would be preplexed while understanding the flow from whereto where the control is jumping.19) What is the difference between return and System.exit(0) ?Ans). Return statement is used inside a method to come out of it. System.exit( 0) is used in any methodto come of the program.20) What is the difference between System.out.exit(0) and System.exit(1) ?Ans). System.exit(0) terminates the program normally. Whereas System.exit(1) terminates the programbecause of some error encountered in the program.21) What is the difference between System.out ,System.err and System.in?Ans). System.out and System.err both represent the monitor by default and hence can be used to senddata or results to the monitor. But System.out is used to display normal messages and results whereasSystem.err is used to display error messages and System.in represents InputStream object, which bydefault represents standard input device, ie, keyboard.22) On which memory, arrays are created in Java?Ans). Arrays are created on dynamic memory by JVM. There is no question of static memory in Java;every thing( variables, array, object etc.) is created on dynamic memory only.23) Can you call the main( ) method of a class from another class ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 4Ans). Yes , we can call the main( ) method of a class from another class using Classname.main( ) . Atthe time of calling the main( ) method, we should pass a string type array to it.24) Is String a class or data type ?Ans). String is a class in java.lang package. But in Java, all classes are also considered as data types. Sowe can take String as a data type also.25) Can we call a class as a data type ?Ans). Yes, a class is also called ‘ user-defined’ data type. This is because a use can dreate a class.26) What is object reference ?Ans). Object reference is a unique hexadecimal number representing the memory address of the object.It is useful to access the members of the object.27) What is difference between == and equals() while comparing strings ? which one isreliable ?Ans). = = operator compares the references of the sting objects. It does not compare the contents of theobjects. equals( ) method compares the contents. While comparing the strings, equals( ) method shouldbe used as it yields the correct result.28) What is a string constant pool ?Ans). Sring constant pool is a separate block of memory where the string objects are held by JVM. If asting object is created directly, using assignment operator as: String s1 = “Hello”,then it is stored instring constant pool.29) Explain the difference between the following two statements: 1. String s=”Hello” 2. String s = new String(“Hello”);Ans). In the first statement, assignment operator is used to assign the string literal to the String variales. In this case, JVM first of all checks whether the same object is already available in the string constantpol. If it is available , then it creates another reference to it. If the same object is not available , then itcreates another object with the content “ Hello “ and stores it into the string constant pool.In the second statement, new operator is used to create the string object, in this case, JVM always createsa new object without looking in the string constant pool.30) What is the difference between String and StringBuffer classes? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 5Ans). String class objects are immutable and hence their contents cannot be modified. StringBuffer classobjects are mutable, so they can be modified. Moreover the methods that directly manipulate data of theobject are not available in String class. Such methods are available in StringBuffer class.31) Are there any other classes whose objects are immutalbe ?Ans). Yes, classes like Character, Byte, Integer, Float, Double, Long..called ‘wrapper classes’ arecreated as ‘immutable’.Classes like Class, BigInteger, Big Decimal are also immutable.32) What is the difference between StringBuffer and StringBuilder classes?Ans). StringBuffer class is synchronized and StringBuilder is not. When the programmer wants to useseveral threads, he should use StringBuffer as it gives reliable results . If only one thread is used.StringBuilder is preferred, as it improves execution time.33) What is object oriented approach ?Ans). Object oriented programming approach is a programming methodology to design computerprograms using classes and objects.34) What is the difference between a class and an object ?Ans). A class is a model for creating objects and does not exist physically. An object is any thing thatexists physically.Both the classes and objects contain variables and methods.35) What is encapsulation ?Ans). Encapsulation is a mechanism where the data(varialbes) and the code(methods) that act on thedata will bind together. For ex,if we take a class, we write the variables and methods inside the class.Thus, class is binding them together. So class is an example for encapsultion.36) What is abstraction ?Ans). Hiding the unnecessary data from the user and expose only needed data is of interest to the user.A good example for abstraction is a car. Any car will have some parts like engine, radiator, mechanicaland electrical equipment etc. The user of the ca r (driver) should know how to drive the car and does notrequire any knowledge of these parts. For example driver is never bothered about how the engine isdesigned and the internal parts of the engine. This is why, the car manufacturers hide these parts fromthe driver in a separate panel, generally at the front.Example in java:Class Bank{ Private int accno; muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 6 Private String name; Private float balance; Private float profit; Private float loan; Public void desplay_to _clerk() { System.out.println(“Accno= “+accno); System.out.println(“Name=” +name); System.out.println(“Balance=”+balance); }}37) What is Inheritance ?Ans). It creates new classes from existing classes, so that the new classes will acquire all the features ofthe existing classes is called inheritance. (or) Acquiring the all properties from base class to child class .38) What is Polymorphism ?Ans). The word ‘Polymorphism’ came from two Greek words ‘poly’ meaning ‘many’ and ‘morphs’meaning ‘forms’ . Thus, polymorphism represents the ability to assume several different forms. Inprogramming, we can use a single variable to refer to objects of different types and thus, using thatvariable we can call the methods of the different objects. Thus a method call can perform different tasksdepending on the type of the object.39) What is the difference between object oriented programming launguages and objectbased programming languages ?Ans). Object oriented programming languages follow all the features of Object Oriented ProgrammingSystem(OOPS). Smalltalk, Simula-67,C++, Java are examples for OOPS languages.Object based programming languages follow all the features of OOPS except Inheritance. For example,JavaScript and VBScript will come under object based programming languages.40) What is hash code ?Ans). Hash code is unique identification number alloted to the objects by the JVM. This hash codenumber is also called reference number which is created based on the location of the object in memory,and is unique for all objects, except for String objects. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 741)How can you find the hash code of an object ?Ans). The hashCode( ) method of ‘Object’ class in java.lang.package is useful to find the hash code ofan object.42) Can you declare a class as ‘private’ ?Ans). No, if we declare a class as private , then it is not available to java compiler and hence a compiletime error occurs, But inner classes can be declared as private.43) When is a constructor called, before or after creating the object ?Ans). A Constructor is called concurrently when the object creation is going on. JVM first allocatesmemory for the object and then executes the constructor to initialize the instance variables. By the time,object creation is completed, the constructor execution is also completed.44) What is the difference between default constructor and parameterized constructor? Default constructor Parameter constructor Default constructor is useful to initialize Parameterized constructor is useful to all objects with same data. initialize each object with different data. Default constructor does not have any Parameterized constructor will have 1 or parameters. more parameteres When data is not passed at the time of When data is passed at the time of creating an object, default constructor is creating an object parameterized called. constructor is called.45) What is the difference between a constructor and a method ? Constructors Methods A constructor is used to initialize the A mehtod is used for any general purpose instance variables of a class. processing or calcultaions. A constructor’s name and class name should A mehtod’s name and class name can be be same. same or different. A constructor is called at the time of A method can be called after creating the creating object. object. A constructor is called only once per object. A method can be called several times on the object. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 846) What is constructor overloading ?Ans). Writing two or more constructors with the same name but with difference in the parameters iscalled constructor overloading. Such constructors are useful to perform different tasks.47) What are instance methods ?Ans). Instance methods are the methods which act on the instance variables of the class. To call theinstance methods , we should use the form; objectname.methodname( ).Ex: double x = obj.sum( );48) What are static methods ?Ans). Static methods are the methods which do not act upon the instance variables of a class. Staticmethods are declared as ‘static’.49) What is the difference between instance variables and class variables(staticvariables) ?Ans). 1. An Instance variable is a variable whose separate copy is availabe to each object. A classvariable is a variable whose single copy in memory is shared by all objects.2. Instance variables are created in the objects on heap memory. Class variables are stored on methodarea.50) Why instance Variables are not available to static methods ?Ans). After executing static methods, JVM creates the objects. So the instance variables of the objectsare not available to static methods.51) Is it possible to compile and run a Java program without writing main( ) method ?Ans). Yes , it is possible by using a static block in the Java program.52) How are objects are passed to methods in Java ? Ans). Premitive data types, objects, even object references – every thing is passed to methods using‘pass by value’ or ‘call by value’ concept. This means their bit by bit copy is passes to the methods.53) What are factory methods ? Ans). A factory methods is a method that creates and returns an object to the class to which itbelongs. A single factory method replaces several constructors in the class by accepting different optionsfrom the user, while creating the object.54) In how many ways can you create an object in Java ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 9 Ans). There are four ways of creating objects in Java: 1. Using new operator Employee obj = new Employee( ); Here , we are creating Employee class object ‘obj’ using new operator. 2. Using factory methods: Number Format obj = NumberFormat. getNumberInstance( ); Here, we are creating NumberFormat object using the factory method getNumberInstance( ) 3. Using newInstance( ) method. Here we should follow tow steps, as: (a) First, store the class name ‘Employee’ as a string into an object. For this purpose, factory metod forName( ) of the class ‘Class’ will be useful: Class c = Class.forName(“Employee”); We should note that there is a class with the name ‘Class’ in java.lang package. (b) Next, create another object to the class whose name is in the object c. For this purpose , we need newInstance( ) method of the class ‘Class’ as: Employee obj = ( Employee)c.newInstance( ); 4. By cloning an already available object, we can create another object. Creating exact copy of an existing object is called ‘cloning’. Employee obj1 = new Employee ( ); Employee obj2 = (Employee)obj1.clone( ); Earlier, we created obj2 by cloning the Employee object obj1.clone( ) method of Object class is used to clone object.We should note that there is a class by the name ‘Object’ in java.lang package.55) What is object graph ?Ans). Object graph is a graph showing relationship between different objects in memory.56) What is anonymous inner class ? Ans). It is an inner class whose name is not written in the outer class and for which only one object iscreated.57) What is Inheritance ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 10Ans). Deriving new classes from existing classes such that the new classes acquire all the features ofexisting classes is called inheritance.58) Why super class members are available to sub class ?Ans). Because, the sub class object contains a copy of super class object.59) What is the advantage of inheritance ? Ans). In inheritance a programmer reuses the super class code without rewriting it, in creation of subclasses So, developing the classes becomes very easy. Hence, the programmer’s productivity is increased.60) Why multiple inheritance is not available in Java ? Ans). Multiple inheritance is not available in Java for the following reasons: 1. It leads to confusion for a Java program. 2. The programmer can achieve multiple inheritance by using interfaces. 3. The programmer can achieve multiple inheritance by repeatedly using single inheritance.61) How many types of inheritance are there ? Ans). There are two types of inheritances single and multiple. All other types are mere combinationsof these two.However, Java supports only single inheritance.62) What is coercion ? Ans). Coercion is the automatic conversion between different data types done by the compiler.63) What is conversion ? Ans). Conversion is an explicit change in the data type specified by the operator.64) What is method signature ? Ans). Method signature represents the method name along with method parmeters.65) What is method overloading ? Ans). Writing two or more methods in the same class in such a way that each mehtod has same namebut with different method signatures – is called method overloading.66) What is method overriding ? Ans). Writing two or more methods in super and sub classes such that the methods have same nameand same signature is called method overriding. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 1167) What is the difference between method overloading and method overriding ?MethodOverloading Method OverridingWriting two or more methods with the same name Writing two or more methods with the same namebut with different signatures is called method and same signatures is called method overriding.overloading.Method overloading is done in the same class. Method overriding is done in super and sub classes.In method overloading, method return type can be In method overriding method return type shouldsame or different. also be same.JVM decides which method is called depending on JVM decides which method is called depending onthe difference in the method signatures. the data type (class) of the object used to call the method.Method overloading is done when the programmer Method overriding is done when the programmerwants to extend the already available features. wants to provide a different implementation(body) for the same feature.Method overloading is code refinement. Same Method overriding is code replacement. The submethod is refined to perform a different task. class method overrides(replaces) the super class method.68) Can you override private methods ? Ans). No, private methods are not available in the sub classes, so they cannot be overriden.69) Can we take private methods and final methods as same ? Ans). Yes. The Java compiler assigns the value for the private methods at the time of compilation. Alsoprivate methods can not be modified at run time. This is the same cases with final methods also. Neitherthe private methods nor the final methods can be overriden . So, private methods can be taken as finalmethods.70) What is final ? Ans). ‘final’ keyword is used in two ways:  It is used to declare constants as: Final double PI = 3.14159; // PI is constant It is used to prevent inheritance as:  Final class A // sub class to A cannot be created. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 1271) What is the difference between dynamic polymorphism and static polymorphism ? Ans). Dynamic polymorphism is the polymorphism existed at runtime. Here, Java compiler does notunderstand which method is called at compilation time. Only JVM decides which method is called atruntime. Method overloading and method overriding using instance methods are the examples fordynamic polymorphism. Static polymorphism is the polymorphism exhibited at compile time. Here, Java compiler knows whichmethod is called. Method overloading and method overriding using static methods; method overridingusing private or final methods are examples for static polymorphism.72) What is difference between primitive data types and advanced data types ? Ans). Primitive data types represent single values. Advanced data types represent a group of values.Also methods are not available to handle the primitive data types. In case of advanced data types,methods are available to perform various operations.73) What is implicit casting ? Ans). Automatic casting done by the Java compiler internally is called implicit casting . Implicitcasting is done to converty a lower data type into a higher data type.74) What is explicit casting ? Ans). The cating done by the programmer is called explicit cating. Explicit casting is compulsory whileconverting from a higher data type to a lower data type.75) What is generalization and specialization ? Ans). Generalization ia a phenomenon wher a sub class is prompted to a super class, and hencebecomes more general. Generalization needs widening or up-casting. Specialization is phenomenonwhere a super class is narrowed down to a sub class. Specialization needs narrowing or down-casting.76) What is widening and narrowing ? Ans). Converting lower data type into a higher data type is called widening and converting a higherdata type into a lower type is called narrowing. Widening is safe and hence even if the programmer doesnot use cast operator, the Java compiler does not flag any error. Narrowing is unsafe and hence theprogrammer should explicitly use cast operator in narrowing.77) Which method is used in cloning ? Ans). clone( ) method of Object class is used in cloning.78) What do you call the interface without any members ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 13 Ans). An interface without any members is called marking interface or tagging interface. It marks theclass objects for a special purpose. For example, Clonable(java.lang) and Serializable(java.io) are twomarking interfaces. Clonable interface indicates that a particular class objects are cloneable whileSerializable interface indicates that a particular class objects are serializable.79) What is abstract method ? Ans). An abstract method is a method without method body. An abstract method is written when thesame method has to perform difference tasks depending on the object calling it.80) What is abstract class ? Ans). An abstract class is a class that contains 0 or more abstract methods.81) How can you force your programmers to implement only the features of your class ? Ans). By writing an abstract class or an interface.82) Can you declare a class as abstract and final also ? Ans). No, abstract class needs sub classes. final key word represents sub classes which can not becreated. So, both are quite contradictory and cannot be used for the same class.83) What is an interface ? Ans). An interface is a specification of method prototypes, All the methods of the interface are publicand abstract.84) Why the methods of interface are public and abstract by default ?Ans). Interface methods are public since they should be available to third party vendors to provideimplementation. They are abstract because their implementation is left for third party vendors.85) Can you implement one interface from another ?Ans). No, we can’t implementing an interface means writing body for the methods. This can not bedone again in an interface, since none of the methods of the interface can have body.86) Can you write a class within an interfae ?Ans). Yes, it is possible to write a class within an interface.87)Explain about interfaces ? Ans). * An interface is a specification of method prototypes, before we proceed furthur, written in theinterface without mehtod bodies. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 14 *An interface will have 0 or more abstract methods which are all public and abstract by default. * An interface can have variables which are public static and final by default. This means all thevariables of the interface are constants.88) What is the difference between an abstract class and an interface ? Abstract class Interface An abstract class is written when there are An interface is written when all the features are some common features shared by all the implemented differently in different objects. objects. When an abstract class is written, it is the duty An interface is written when the programmer of the programmer to provide sub classes to it. wants to leave the implementation to the third party vendors. An abstract class contains some abstract An interface contains only abstract methods. methods and also some concrete methods. An abstract class contain instance variables An interface can not contain instance also. variables. It contains only constants. All the abstract methods of the abstract class All the (abstract) methods of the interface should be implemented in its sub classes. should be implemented in its implementation classes. Abstract class is declared by using the Interface is declared using the keyword keyword abstract. interface.89)A programmer is writing the following statements in a program: 1. import java.awt.*; 2. import java.awt.event.*; Should he write both the statements in his program or the first onw is enough ?Ans). event is a sub package of java.awt package. But, when a package is imported, its sub packages arenot automatically imported into a program. So, for every package or sub package, a separate importstatement should be written. Hence if the programmer wants the classes and interfaces of both thejava.awt and java.awt.event packages, then he should both the preceding statements in his program. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 1590) How can you call the garbage collector ? Ans). We can call garbage collector of JVM to delete any unused variables and unreferenced objectsfrom memory using gc( ) method. This gc( ) method appears in both Runtime and System classes ofjava.lang package. For example, we can call it as:System.gc( );Runtime.getRuntime( ).gc( );91) What is the difference between the following two statements. 1. import pack.Addition; 2. import pack.*;Ans) . In statement 1, only the Addition class of the package pack is imported into the program and instatement 2, all the classes and interfaces of the package pack are available to the program. If a programmer wants to import only one class of a package say BufferedReader of java.io package,we can write import java.io.BufferedReader;92) What is the differentiate between .ear, .jar and .war files.?Ans). These files are simply zipped file using java jar tool. These files are created for different purposes.Here is the description of these files:.jar files: These files are with the .jar extenstion. The .jar files contains the libraries, resources andaccessories files like property files..war files: These files are with the .war extension. The war file contains the web application that can bedeployed on the any servlet/jsp container. The .war file contains jsp, html, javascript and other files fornecessary for the development of web applications..ear files: The .ear file contains the EJB modules of the application.93) What is CLASSPATH ?Ans) . The CLASSPATH is an environment variable that tells the Java compiler where to look for classfiles to import. CLASSPATH is generally set to a directory or a JAR(Java Archive)file.94) What is a JAR file ?Ans) A Java Archive file (JAR) is a file that contains compressed version of several .class files, audiofiles, image files or directories. JAR file is useful to bundle up several files related to a project and usethem easily.95) What is the scope of default acess specifier ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 16 Ans). Default members are available within the same package, but not outside of the package. So theirscope is package scope.96)What happens if main( ) method is written without String args[ ] ?Ans). The code compiles but JVM cannot run it, as it cannot see the main( ) method with String args[ ].97). What are checked exceptions ?Ans). The exceptions that are checked at compilation-time by the Java compiler are called ‘checkedexceptions’. The exceptions that are checked by the JVM are called ‘unchecked exceptions’.98). What is Throwable ?Ans). Throwable is a class that represents all errors and exceptions which may occur in Java.99). Which is the super class for all exceptions ?Ans). Exception is the super class of all exceptions in Java.100). What is the difference between an exception and an error ?Ans). An exception is an error which can be handled. It means when an exception happens, theprogrammer can do something to avoid any harm. But an error is an error which cannot be handled, ithappens and the programmer cannot do any thing.101). What is the difference between throws and throw ?Ans). throws clause is used when the programmer does not want to handle the exception and throw it outof a method. throw clause is used when the programmer wants to throw an exception explicitly and wantsto handle it using catch block. Hence, throws and throw are contracictory.102). Is it possible to re-throw exceptions ?Ans). Yes, we can re-throw an exception from catch block to another class where it can be handled.103). Why do we need wrapper classes ?1. They convert primitive data types into objects and this is needed on Internet to mommunicate betweentwo applications.2. The classes in java.util package handle only objects and hence wrapper classes help in this case also.104). Which of the wrapper classes contains only one constructor ? (or) Which of the wrapper classesdoes not contain a constructor with String as parameter ?Ans). Character.105). What is unboxing ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 17Ans). Converting an object into its corresponding primitive datatype is called unboxing.106). What happens if a string like “ Hello” is passed to parseInt ( ) method ?Ans). Ideally a string with an integer value should be passed to parseInt ( ) method. So, on parsing“Hello”, an exception called “NumberFormatException’ occurs since the parseInt( ) method cannotconvert the given string “Hello” into an integer value.107).What is a collection framework ?Ans). A collection framework is a class library to handle groups of objects. Collection framework isimplemented in java.util.package.108). Does a collection object store copies of other objects or their references ?Ans). A Collection object stores references of other objects.109). Can you store a primitive data type into a collection ?Ans). No, Collections store only objects.110). What is the difference between Iterator and ListIterator ?Ans). Both are useful to retreive elements from a collection. Iterator can retrieve the elements only inforward direction. But Listener can retrieve the elements in forward and backward direction also. SoListIterator is preferred to Iterator.111). What is the difference between Iterator and Enumeration ?Ans). Both are useful to retreive elements from a collection. Iterator has methods whose names are easyto follow and Enumeration methods are difficult to remember. Also Iterator has an option to removeelements from the collection which is not available in Enumeration. So, Iterator is preferred toEnumeration.112). What is the difference between a Stack and LinkedList ?Ans). 1. A Stack is generally used for the purpose of evaluation of expression. A LinkedList is used tostore and retrieve data. 2. Insertion and deletion of elements only from the top of the Stack is possible. Insertion anddeletion of elements from any where is possible in case of a LinkedList.113). What is the difference between ArrayList and Vector ? ArrayList Vector ArrayList object is not synchronized by Vector object is synchronized by default. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 18 default Incase of a single thread, using ArrayList is In case of multiple threads, using Vector is faster than the Vector. advisable. With a single thread, Vector becomes slow. ArrayList increases its size every time by 50 Vector increases its size every time by percent (half). doubling it.114). Can you synchronize the ArrayList object ?Ans). Yes, we can use synchronizedList( ) method to synchronize the ArrayList, as:Collections.synchronizedList(new ArrayList( ));115). What is the load factor for a HashMap or Hashtable ?Ans). 0.75.116). What is the difference between HashMap and Hashtable ?Ans).HashMap HashtableHashMap object is not synchronized by default. Hashtable object is synchronized by default.In case of a single thread, using HashMap is faster In case of multiple threads, using Hashtable isthan the Hashtable. advisable, with a single thread, Hashtable becomes slow.HashMap allows null keys and null values to be Hashtable does not allow null keys or values.stored.Iterator in the HashMap is fail-fast. This means Enumeration for the Hashtable is not fail-fast. ThisIterator will produce exeception if concurrent means even if concurrent updations are done toupdates are made to the HashMap. Hashtable, there will not be any incorrect results produced by the Enumeration.117). Can you make HashMap synchronized ?Ans). Yes, we can make HashMap object synchronized using synchronizedMap( ) method as shown here:Collections.synchronizedMap(new HashMap( ));118). What is the difference between a Set and a List ?Ans). muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 19Set ListA set represents a collection of elements. Order of A List represents ordered collection ofthe elements may change in the set. elements.List preserves the order of elements in which they are entered.Set will not allow duplicate values to be stored. List will allow duplicate values.Accessing elements by their index (position Accessing elements by index is possible in lists.number) is not possible in case of sets.Sets will not allow null elements. Lists allow null elements to be stored.119). What is the difference between System.out and System.err ?Ans). Both are used to display messages on the monitor. System.out is used to display normal messagesAs: System.out.println(“This is nayanimuralidhar”); System.err.println(“This is an error”);120). What is the advantage of stream concept..?Ans). Streams are mainly useful to move data from one place to another place. This concept can be usedto receive data from an input device and send data to an output device.121). What is the default buffer size used by any buffered class ?Ans). 512 bytes.122). What is serialization ?Ans). Serialization is the process of storing object contents into a file. The class whose objects are storedin the file should implement ‘serializable’ interface of java.io.package.123).What type of variables cannot be serialized ?Ans). Static and transient variables cannot be serialized.Once the objects are stored into a file, they can be later retrieved and used as and when needed.This iscalled de-serialization.124). What is IP address ?Ans). An IP address is a unique identification number allocated to every computer on a network orInternet. IP address contains some bytes which identify the network and the actual computer inside thenetwork. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 20125). What is DNS ?Ans). Domain Naming Service is a service on Internet that maps the IP address with correspondingwebsite names.126). What is a socket ?Ans). A socket is a point of conneciton between a server and a client on a network.127). What is port number ?Ans). Port number ia a 2 byte number which is used to identify a socket uniquely.128). Which thread always runs in a Java program by default ?Ans). main thread. A thread represents execution of statements. The way the statements are executed is oftwo types: 1). Single tasking 2). Multi tasking.129). Why threads are called light-weight ?Ans). Threads are light-weight because they utilize minimum resources of the system. This means theytake less memory and less processor time.130). What is the difference between single tasking and multitasking ? Ans). Executing only one job at a time is called single tasking. Executing several jobs at a time is calledmulti tasking. In single tasking, the processor time is wasted, but in multi tasking, we can utilize theprocessor time in an optimum way.131). How can you stop a thread in Java ?Ans). First of all , we should create a boolean type variable which stores ‘ false’ . When the user wants tostop the thread. We should store ‘true’into the variable. The status of the variable is checked in the run ( )method and if it is true, the thread executes ‘return’ statement and then stops.132). What is the difference between ‘ extends Thread’ and ‘implements Runnable’ ? Which oneis advatageous ?Ans). extends Thread and implements Runnable – both are functionally same. But when we write extendsThread, there is no scope to extend another class, as multiple inheritance is not supported in Java.Class Myclass extends Thread, AnotherClass //invalidIf we write implements Runnable, then still there is scope to extend another class.class Myclass extends AnotherClass implements Runnable //valid muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 21This is definitely advantageous when the programmer wants to use threads and also wants to access thefeatures of another class.133). Which method is executed by the thread by default ?Ans). public void run( ) method.134). What is Thread synchronization ?Ans). When a thread is already acting on an object, preventing any other thread from acting on the sameobject is called ‘Thread synchronization’ or ‘Thread safe’ The object on which the threads aresynchronized is called ‘synchronized object’. Thread synchronization is recommended when multiplethreads are used on the same object(in multithreading).135). What is the difference between synchronized block and synchronized keyword ?Ans). Synchronized block is useful to synchronized a block of statements. Synchronized keyword isuseful to synchronize an entire method.138). What is Thread deadlock ?Ans). When a thread has locked an object and waiting for another object to be released by anotherthread.and the other thread is also waiting for the first thread to release the first object, both the threadswill continue waiting forever. This is called ‘Thread deadlock’.139). What is the difference between the sleep( ) and wait( ) methods ?Ans). Both the sleep( ) and wait( ) methods are used to suspend a thread execution for a specified time.When sleep( ) is executed inside a synchronized block, the object is still under lock. When wait( ) methodis executed, it breaks the synchronized block, so that the object lock is removed and it is available. Generally, sleep( ) is used for making a thread to wait for some time. But wait( ) is used in connectionwith notify ( ) or notifyAll( ) mehtods in therad communication.140). What is the default priority of a thread ?Ans). When a thread is created, by default its priority will be 5.141). What is demon thread ?Ans). A daemon thread is a thread is a thread that executes continuously. Daemon threads are serviceproviders for other threads or objects. It generally provides a background procssing.142). What is thread life cycle ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 22Ans). A thread is created using new Thread( ) statement and is executed by start( ) method. The threadenters ‘runnable’ state and when sleep( ) or wait( ) methods are used or when the thread is blocked on I/O,it then goes into ‘not runnable’ state. From ‘not runnable’ state, the thread comes back to the ‘runnable’state and continues running the statements. The thread dies when it comes out of run( ) mehtod . Thesestate thransitions of a thread are called ‘life cycle of a thread’.143). What is the difference between a window and a frame ?Ans). A window is a frame without any borders and title, whereas a frame contains borders and title.144). What is event delegation model ?Ans). Event delegation model represents that when an event is generated by the user on a component, it isdelegated to a listener interface and the listener calls a mehtod in response to the event. Finally , the eventis handled by the method.145). Which model is used to provide actions to AWT components ?Ans). Event delegation model.146). What is an adapter class ?Ans). An adapter class is an implementation class of a listener which contains all methods implementedwith empty body. For example, WindowAdapter is an adapter class of WindowListener interface.Adapter classes reduce overhead on programming while working with listener interfaces.147). What is anonymous inner class ?Ans). Anonymous inner class is an inner class whose name is not mentioned, and for which only oneobject is created.148). What is the default layout in a frame ?Ans). BorderLayout.149). What is the default layout in an applet ?Ans). FlowLayout.150).What are Java Foundation classes ?Ans). Java Foundation classes (JFC) represented a class library developed in pure Java which is anextension to AWT.151). Discuss about the MVC architecture in JFC/ swing ? muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 23Ans). Model- View – Controller is a model used in swing components. Model represents the data of thecomponent. View represents its appearance and controller is a mediater between the model and theview.MVC represents the separation of model of an object from its view and how it is controlled.152). What are the various window panes available in swing ?Ans). There are 4 window panes: Glass pane, Root pane, Layered pane, and Content pane.153). Where are the borders available in swing ?Ans). All borders are available in BorderFactory class in javax.swing.border package.154). What is an applet ?Ans). An applet represents Java byte code embedded in a web page.155).What is applet life cycle ?Ans). An applet is born with init( ) method and starts functioning with start( ) method. To stop the applet,the stop( ) method is called and to terminate the applet completely from memory, the destroy( ) method iscalled. Once the applet is terminated, we should reload the HTML page again to get the applet start onceagain from init( ) method. This cyclic way of executing the methods is called applet life cycle.156). Where are the applets executed ?Ans). Applets are executed by a program called applet engine which is similar to virtual machine thatexists inside the web browser at client side.157). What is HotJava?Ans).Hot Java is the first applet-enabled browser developed in Java to support running of applets.158). Which tag is used to embed an applet into a HTML page ?Ans). <APPLET> tag is used to insert an applet into HTML page.159). What is a generic type ?Ans). A generic type represents a class or an interface that is type-safe. It can act on any data type.160). Whai is erasure ?Ans). Creating non-generic version of a generic type by the Java compiler is called erasure.161). What is auto boxing ?Ans). Auto boxing refers to creating objects and storing primitive data types automatically by thecompiler. muralidhar.9e@gmail.com 10/sep/2010
Java FAQs http://javabynataraj.blogspot.com 24162). What is JDBC ?Ans). JDBC (Java Database Connectivity) is an API that is useful to write Java programs to connect toany database, retreive the data from the database and utilize the data in a Java program.163). What is a database driver ?Ans). A database driver is a set of classes and interfaces, written according to JDBC API to communicatewith a database.164). How can you register a driver ?Ans). To register a database driver, we can follow one of the 4 options: - By creating an object to driver class - By sending driver class object to DriverManager.registerDriver( ) method - By sending the driver class name to Class.forName( ) method - By using System class getProperty( ) method. --------****ALL THE BEST****-------- Muralidhar.N muralidhar.9e@gmail.com 10/sep/2010
பல பரிமாணத்தில் அமைந்துள்ள �...

value: This website is an American hosting service, now owned by Scribd, for professional content including presentations, infographics, documents, and videos. Users can upload files privately or publicly in PowerPoint, Word, PDF, or OpenDocument format.


text:
Fourier Transform in Digital Signal Processing - CodeProject
Jakub Szymanowski, 6 Mar 2016
Download DiscreteFourierTransform.zip - 126.5 KB
Download DiscreteFourierTransform.dll.zip - 4.5 KB
The frequency analysis is the one of the most popular methods in signal processing. It is a tool for signal decomposition for further filtration, which is in fact separation of signal components from each other.
Although, the process of crossing the border between these two worlds (time and frequency domain) may be considered as advanced case, it is worth doing it, as this other world gives us new opportunities and simplifies many issues.
The article presents implementation of the various versions of calculating Discrete Fourier Transform, starting with definition of Fourier Transform, by reduced calculation algorithm and finishing with Cooley-Tukey method of Fast Fourier Transform.
In addition, it presents the importance of the simplest operations performed on the signal spectrum and their impact on the time domain.
Signal can be defined as a variability of any physical value, that can be described as a function of a single or multiple arguments. In this article we will be interested in one-dimensional time functions.
In real world, time functions that can be met are placed in continuous domain. However, the development of computer science, caused that analog signal processing became rare. It is much more cost-effective to create, implement and test signal processing algorithms in digital world, then to project and develop analog (electronic) devices.
From continuous to discrete domain
In order to receive digital representation of analog signal it needs to be turned into discrete-time domain and quantized.
The Nyquist-Shannon sampling theorem is the link between continuous-time signals and discrete-time signals. This theorem can be also known as The Whittaker-Nyquist-Kotielnikov-Shannon sampling theorem – the choice of the authors names depending on the country in which we talk about this issue. To be above this, we will call it simply the sampling theorem.
The sampling theorem answers the question of how to sample a continuous-time signal to obtain a discrete-time signal, from which you can restore original (continuous-time) signal. According to this statement to obtain a properly sampled discrete-time signal, the sampling frequency must be at least twice of highest frequency that can be observed in original signal.
Signal decomposition into frequency domain
It all started in 1807 when the French mathematician and physicist, Joseph Fourier, introduced the trigonometric series decomposition (nowadays know as Fourier series method) to solve the partial differential heat equation in the metal plate. Fourier's idea was to decomposed complicated periodic function into to sum of the simplest oscillating functions - sines ans cosines.
If the function f(x) is periodic with period of T and intergrable (its integral is finite) on an interval [x0, x0 + T], then it can be transformed into series:
$\begin{aligned} f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} (a_n \cdot cos(\frac{2 n \pi}{T}x) + b_n \cdot sin(\frac{2 n \pi}{T}x)) \end{aligned}$
$\begin{aligned} a_n = \frac{2}{T} \int_{x_0}^{x_0 + T} f(x) \cdot cos(\frac{2 n \pi}{T}x) dx \\ b_n = \frac{2}{T} \int_{x_0}^{x_0 + T} f(x) \cdot sin(\frac{2 n \pi}{T}x) dx \end{aligned}$
Fourier series can be named a progenitor of Fourier Transform, which, in case of digital signals (Discrete Fourier Transform), is described with formula:
$\begin{aligned} X(k) = \frac{1}{N} \sum_{n=0}^{N-1} x(n) \cdot e^{-j \frac{2 \pi}{N} k n } \end{aligned}$
Fourier transformation is reversible and we can return to time domain by calculation:
$\begin{aligned} x(n) = \sum_{k=0}^{N-1} X(k) \cdot e^{j \frac{2 \pi}{N} k n } \end{aligned}$
In some notations we can observe that divide by N is transterred to inverse calculation - it does not disrupt the calculation unless we apply divide by N both in forward and inverse Fourier Transform.
Forward and inverse Discrete Fourier Transform implementations are shown below.
/// Calculates Discrete Fourier Transform of given digital signal x
/// <param name="x">Signal x samples values</param>
/// <returns>Fourier Transform of signal x</returns>
public Complex[] DFT(Double[] x)
int N = x.Length; // Number of samples
X[k] += x[n] * Complex.Exp(-Complex.ImaginaryOne * 2 * Math.PI * (k * n) / Convert.ToDouble(N));
X[k] = X[k] / N;
/// Calculates inverse Discrete Fourier Transform of given spectrum X
/// <param name="X">Spectrum complex values</param>
/// <returns>Signal samples in time domain</returns>
public Double[] iDFT(Complex[] X)
int N = X.Length; // Number of spectrum elements
sum += X[k] * Complex.Exp(Complex.ImaginaryOne * 2 * Math.PI * (k * n) / Convert.ToDouble(N));
x[n] = sum.Real; // As a result we expect only real values (if our calculations are correct imaginary values should be equal or close to zero)
The mistake often committed in code implementation of inverse Fourier Transform is to transfer complex value to real by using its magnitude value - in such a case we will receive |x(n)| instead of x(n).
Practical example of Discrete Fourier Transform calculated by definition
To verify algorithm let us create a signal that is a sum of two sine waves:
$\begin{aligned} x_1(n) = sin(0.02 \pi n) \end{aligned}$
$\begin{aligned} x_2(n) = 0.25 \cdot sin(0.2 \pi n) \end{aligned}$
Denote by x1(n) an original signal and by x2(n) a disruption signal (noise). The sum of those signals x(n) = x1(n)+x2(n) is in that case a disrupted signal.
$\begin{aligned} x(n) = x_1(n) + x_2(n) \end{aligned}$
$\begin{aligned} n = 0, 1, ..., 100 \end{aligned}$
Fig.1. Original and disruption signals
Fig.2. The sum of signals (disrupted signal)
As we created our signal from the sum of two sine waves, then according to the Fourier theorem we should receive its frequency image concentrated around two frequencies f1 and f2 and also its opposites -f1 and -f2.
Fig.3. Amplitude spectrum of disrupted singal.
If Fourier theorem is correct, then by removing from spectrum stripes that came from disruption signal, we should receive original signal.
Fig.4. Spectrum with removed disruption frequency and its inverse DFT result
As we can observe in figure 4, our output signal is close to original one and the distortions are caused by additional stripes have arisen as a result of numerical operations. Let's remove them all, and leave only two main stripes.
Fig.5. Spectrum with only main frequency and its inverse DFT result.
The output signal in figure 5 looks like perfect sine wave. But to show minor differences between output and original signal see comparison below.
Fig.6. Original and output signal comparison.
In figure 3 we cannot see any negative values, so why did we said, that calculated spectrum is concentrated around two frequencies f1 and f2 and also its opposites -f1 and -f2?
It is because we get use to analyze signals which are defined in range symmetric to the origin. If we denote our disrupted signal x(n) as:
$\begin{aligned} n = -50, -49, ..., -1, 0, 1, ..., 49, 50 \end{aligned}$
Fig.7. Shifted signal
and implement minor change in our algorithm:
/// Calculates forward Discrete Fourier Transform of given digital signal x with respect to sample numbers
/// <param name="SamplesNumbers">Samples numbers vector</param>
public Complex[] DFT(Double[] x, int[] SamplesNumbers)
Double s1 = SamplesNumbers[k]; // Get sample index
Double s2 = SamplesNumbers[n]; // Get sample index
X[k] += x[n] * Complex.Exp(-Complex.ImaginaryOne * 2 * Math.PI * (s1 * s2) / Convert.ToDouble(N));
we will receive amplitude spectrum shown below.
Fig.8. Amplitude spectrum of shifted signal
The same change needs to be implemented in inverse DFT method.
/// Calculates inverse Discrete Fourier Transform of given spectrum X with respect to sample numbers
public Double[] iDFT(Complex[] X, int[] SamplesNumbers)
Double s1 = SamplesNumbers[n]; // Get sample index
Double s2 = SamplesNumbers[k];  // Get sample index
sum += X[k] * Complex.Exp(Complex.ImaginaryOne * 2 * Math.PI * (s1 * s2) / Convert.ToDouble(N));
Notice, that by shifting signal to symmetrical position to the orgin, we calculated shifted spectrum:
$\begin{aligned} X(k) \rightarrow X(k - \frac{N}{2}) \end{aligned}$
The same effect can be achieved, if we change original signal using formula
$\begin{aligned} x(n) \rightarrow (-1)^n \cdot x(n) \end{aligned}$
In this case, there is no need to store the actual numbers of samples. For this use the method is shown below.
/// Shifts spectrum by changing original signal before Fourier Transform
/// <param name="x">Original signal</param>
/// <returns>Shifted signal</returns>
public Double[] Shift(Double[] x)
x[i] = (int)Math.Pow(-1, i) * x[i];
Discrete Fourier Transform with a reduced number of calculations
Let us look again at the forward Discrete Fourier Transform definition:
Denote by WN auxiliary variable:
$\begin{aligned} W_N = e^{-j \frac{2 \pi }{N}}\end{aligned}$
Then our formula takes the form
$\begin{aligned} X(k) = \frac{1}{N} \sum_{n=0}^{N-1} x(n) \cdot W_N ^{k n} \end{aligned}$
Also we can notice that if k = 0 or n = 0 we receive:
$\begin{aligned} W_N^{k n} = 1 \end{aligned}$
Accordingly, the designation of DTF can be written in matrix form:
$\begin{aligned} \begin{bmatrix} X[0] \\ X[1] \\ \vdots \\ X[N-1] \end{bmatrix} = \frac{1}{N} \begin{bmatrix} 1 & 1 & 1 & \dots & 1 \\ 1 & W_N & W_N^2 & \dots & W_N^{N-1} \\ 1 & W_N^2 & W_N^4 & \dots & W_N^{N-2} \\ 1 & W_N^3 & W_N^6 & \dots & W_N^{N-3} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & W_N^{N-1} & W_N^{N-2} & \dots & W_N \end{bmatrix} \cdot \begin{bmatrix} x[0] \\ x[1] \\ \vdots \\ x[N-1] \end{bmatrix} \end{aligned}$
It follows that, to determine the Dicrete Fourier Transform of N-samples signal, we have to perform N2 multiplication operations and determine the (N-1)2 coefficients in matrix WN. Remind that multiplication opertion is one of the most time-consuming opertion for processors.
Let us return to factor WN and consider N=4 samples signal x(n). To calculate X(k) we need to find values of matrix coefficients:
$\begin{aligned} \begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & W_4 & W_4^2 & W_4^3 \\ 1 & W_4^2 & W_4^4 & W_4^2 \\ 1 & W_4^3 & W_4^2 & W_4 \end{bmatrix} \end{aligned}$
$\begin{aligned} W_4 = e^{-j \frac{\pi}{2}} = cos(-\frac{\pi}{2}) + j \cdot sin(-\frac{\pi}{2}) = cos(\frac{\pi}{2}) - j \cdot sin(\frac{\pi}{2}) = -j \end{aligned}$
$\begin{aligned} e^{j \phi} = cos(\phi) + j \cdot sin(\phi) \end{aligned}$
Next values are
$\begin{aligned} \begin{matrix} W_4^2 = -1 \\ W_4^3 = j \\ W_4^4 = -1 \end{matrix} \end{aligned}$
$\begin{aligned} \begin{matrix} W_4^2 = -W_4^0 \\ W_4^3 = -W_4^1 \end{matrix} \end{aligned}$
Similar situation can be noticed for N=8:
$\begin{aligned} \begin{matrix} W_8^1 = e^{-j \frac{\pi}{4}} = cos(\frac{\pi}{4}) - j \cdot sin(\frac{\pi}{4}) = \frac{\sqrt{2}}{2}(1 - j) = \frac{1-j}{\sqrt{2}} \\ W_8^2 = (\frac{(1-j)^2}{2}) = -j \\ W_8^3 = -j \cdot \frac{1-j}{\sqrt{2}} = \frac{-1-j}{\sqrt{2}} \\ W_8^4 = \frac{-1-j}{\sqrt{2}} \cdot \frac{1-j}{\sqrt{2}} = -1 \\ W_8^5 = - \frac{1-j}{\sqrt{2}} \\ W_8^6 = - (\frac{1-j}{\sqrt{2}})^2 = j \\ W_8^7 = j \cdot \frac{1-j}{\sqrt{2}} = \frac{1+j}{\sqrt{2}} \\ W_8^8 = \frac{1+j}{\sqrt{2}} \cdot \frac{1-j}{\sqrt{2}} = 1 \end{matrix} \end{aligned}$
that provides to:
$\begin{aligned} \begin{matrix} W_8^4 = -W_8^0 \\ W_8^5 = -W_8^1 \\ W_8^6 = -W_8^2 \\ W_8^7 = -W_8^3 \end{matrix} \end{aligned}$
In general, for N-samples signal we can write:
$\begin{aligned} \begin{matrix} W_N^z = - W_N^{z - \frac{N}{2}} \\ z = \frac{N}{2}, \frac{N}{2} + 1, \frac{N}{2} + 2, ..., N \end{matrix}\end{aligned}$
This observation leads us to the conclusion that in determining the DFT we calculate only N/2 - 1 spectral coefficients, and another we can get from the previous ones - it is a property of symmetry of the spectrum. Due to this observation four times reduced the number of operations within the algorithm. This observation is true only if we deal with the physical signals, that is signals with real values.
/// Calculates forward Discrete Fourier Transform of given digital signal x with reduced number of multiplications
public Complex[] DFT2(Double[] x)
// Zero-index element calculation
X[0] = x.Sum() / N;
for (int k = 1; k < N/2 + 1; k++)
// Miss additional calculation for center element
if (k != N / 2)
X[N - k] = new Complex(X[k].Real, -X[k].Imaginary);
/// Calculates forward Discrete Fourier Transform of given digital signal x with respect to sample numbers and reduced number of multiplications
public Complex[] DFT2(Double[] x, int[] SamplesNumbers)
for (int k = 0; k < N / 2 + 1; k++)
Double s1 = SamplesNumbers[k];
Double s2 = SamplesNumbers[n];
if (k != N/2)
X[N - k - 1] = new Complex(X[k].Real, -X[k].Imaginary);
Fig.9. Amplitude spectrum of signal from fig.2. designated with DFT with reduced number of calculation
Fig.10. Amplitude spectrum of signal from fig.7. designated with DFT with reduced number of calculation
Fourier Transform formula can be splitted into:
$\begin{aligned} X(k) = \frac{1}{N} \sum_{n=0}^{N-1} x(n) \cdot e^{-j \frac{2 \pi}{N} k n } = \frac{1}{N} \sum_{n=0}^{\frac{N}{2}-1} x(2n) \cdot W_N^{2nk} + \frac{1}{N} \sum_{n=0}^{\frac{N}{2}-1} x(2n + 1) \cdot W_N^{(2n+1)k} \end{aligned}$
$\begin{aligned} W_N^{2nk} = e^{-j \frac{2 \pi}{N} 2 n k} = e^{-j \frac{2 \pi}{\frac{N}{2}}nk} = W_{\frac{N}{2}}^{n k} \end{aligned}$
$\begin{aligned} W_N^{(2n+1)k} = W_N^{2nk + k} = W_N^{2nk} \cdot W_N^{k} = W_{\frac{N}{2}}^{n k} \cdot W_N^{k} \end{aligned}$
$\begin{aligned} X(k) = \frac{1}{N} \sum_{n=0}^{\frac{N}{2}-1} x(2n) \cdot W_{\frac{N}{2}}^{n k} + \frac{1}{N} \cdot W_N^{k} \sum_{n=0}^{\frac{N}{2}-1} x(2n + 1) \cdot W_{\frac{N}{2}}^{n k} \end{aligned}$
that can be written in a simpler form, that separates the calculations performed for the even samples, from those performed for the odd ones:
$\begin{aligned} X(k) = X_E(k) + W_N^k \cdot X_O(k) \end{aligned}$
Accordingly, referring to our previous calculations for the case N = 8 can be written as:
$\begin{aligned} \begin{matrix} X(0) = X_E(0) + W_8^0 \cdot X_O(0) \\ X(1) = X_E(1) + W_8^1 \cdot X_O(1) \\ X(2) = X_E(2) + W_8^2 \cdot X_O(2) \\ X(3) = X_E(3) + W_8^3 \cdot X_O(3) \\ X(4) = X_E(0) + W_8^4 \cdot X_O(0) = X_E(0) - W_8^0 \cdot X_O(0) \\ X(5) = X_E(1) + W_8^5 \cdot X_O(1) = X_E(1) - W_8^1 \cdot X_O(1) \\ X(6) = X_E(2) + W_8^6 \cdot X_O(2) = X_E(2) - W_8^2 \cdot X_O(2) \\ X(7) = X_E(3) + W_8^7 \cdot X_O(3) = X_E(3) - W_8^3 \cdot X_O(3) \\ \end{matrix} \end{aligned}$
which can be presented as graph:
Fig.11. DFT decomposition into even and odd samples calculation.
Note that the elements:
can be calculated in the same way: elements x(0), x(4), x(1) and x(5) are in their diagrams the even indices, whereas x(2), x(6), x(3) and x(7) are the odd ones. Combining them in the ordered pairs, the above graphs can be redraw:
Fig.12. Fast Fourier Transform (RADIX-2) for N = 8 signal.
Designating DFT definition for N = 8 signal we had to perform 64 operations of multiplication, but due to the above observation, we made them only 12. The greater the number of samples in the signal, the greater benefit in calculations number with the use of the FFT algorithm, since the amount of calculations for N-smaple signal can be determined as:
$\begin{aligned} \begin{matrix} \frac{N}{2} log_2(N) \end{matrix} \end{aligned}$
The basic element of such a calculation is called "butterfly":
$\begin{aligned} \begin{matrix} Y(k) = y(k) + W_N^k \cdot y(k + \frac{N}{2}) \\ Y(k + \frac{N}{2}) = y(k) - W_N^k \cdot y(k + \frac{N}{2}) \end{matrix} \end{aligned}$
Successive decomposition stages for smaller, down to the basic "butterflies" may be carried out only on the assumption that N is a power of 2.
Fast Fourier Transform in practice
Proper number of samples
The easiest way to processed signal have the number of samples which is a power of 2, simply fill in the missing samples of zeros. Depending on the signal structure, additions can be made as right-hand, left-hand or both sides.
Fig.13. Complemented signal from fig.2
To connect consecutive signal samples in the respective pairs, we are using preliminary sorting algorithms. However, the FFT algorithm can be performed on samples unsorted, and the sorting operation (in the same way) can be performed on the samples of the spectrum.
In the hardware spectrum analyzers and low-level programming languages sorting samples it is much easier, because the operation is based on a simple inversion of bits in the binary representation of the index sample.
In our N = 8 signal we can notice that:
$\begin{aligned} \begin{matrix} x(0) & 000 & \rightarrow & 000 & x(0) \\ x(1) & 001 & \rightarrow & 100 & x(4) \\ x(2) & 010 & \rightarrow & 010 & x(2) \\ x(3) & 011 & \rightarrow & 110 & x(6) \\ x(4) & 100 & \rightarrow & 001 & x(1) \\ x(5) & 101 & \rightarrow & 101 & x(5) \\ x(6) & 110 & \rightarrow & 011 & x(3) \\ x(7) & 111 & \rightarrow & 111 & x(7) \end{matrix} \end{aligned}$
Method implementation in general case:
/// Input data sorting using bit reversal method
/// <param name="x">Original input signal samples</param>
/// <returns>Sorted signal samples</returns>
public Double[] FFTDataSort(Double[] x)
int N = x.Length; // signal length
if (Math.Log(N, 2) % 1 != 0)
throw new Exception("Number of samples in signal must be power of 2");
Double[] y = new Double[N]; // output (sorted) vector
int BitsCount = (int)Math.Log(N, 2); // maximum number of bits in index binary representation
string bin = Convert.ToString(n, 2).PadLeft(BitsCount, '0'); // index binary representation
StringBuilder reflection = new StringBuilder(new string('0', bin.Length));
reflection[bin.Length - i - 1] = bin[i]; // binary reflection
int number = Convert.ToInt32(reflection.ToString(),2); // new index
y[number] = x[n];
This operation can, however, be performed much faster, without need to convert the index number to the binary form:
/// Input data sorting using index shift method
public Double[] FFTDataSort2(Double[] x)
int m = 1; // original index
for (int n = 0; n < N - 1; n++) // n - new index
Double T = x[m-1];
x[m-1] = x[n];
x[n] = T;
int s = N / 2; // shift operator
m = m - s;
Fig.14. Sorted signal samples (signal from fig.2. complemented at the right side)
Fast Fourier Transfom algorithm
FFT algorithm implementation is shown below.
/// Calculates forward Fast Fourier Transform of given digital signal x
public Complex[] FFT(Double[] x)
Complex[] X = new Complex[N]; // Signal specturm
// Rewrite real signal values to calculated spectrum
X[i] = new Complex(x[i], 0);
int S = (int)Math.Log(N, 2); // Number of calculation stages
for (int s = 1; s < S + 1; s++) // s - stage number
int BW = (int)Math.Pow(2, s - 1); // the width of butterfly
int Blocks = (int)(Convert.ToDouble(N) / Math.Pow(2, s)); // Number of blocks in stage
int BFlyBlocks = (int)Math.Pow(2, s - 1); // Number of butterflies in block
int BlocksDist = (int)Math.Pow(2, s); // Distnace between blocks
Complex W = Complex.Exp(-Complex.ImaginaryOne * 2 * Math.PI / Math.Pow(2, s)); // Fourier Transform kernel
for (int b = 1; b < Blocks + 1; b++)
for (int m = 1; m < BFlyBlocks + 1; m++)
int itop = (b - 1) * BlocksDist + m; // top butterfly index
int ibottom = itop + BW; // bottom butterfly index
Complex Xtop = X[itop-1]; // top element -> X(k)
Complex Xbottom = X[ibottom-1] * Complex.Pow(W, m - 1); // bottom element -> X(k + N/2)
// Butterfly final calculation
X[itop-1] = Xtop + Xbottom;
X[ibottom-1] = Xtop - Xbottom;
// Spectrum scaling
X[i] = X[i] / Convert.ToDouble(N);
Fig.15. FFT - Amplitude spectrum of signal with sorted samples (from fig.14)
Fig.16. FFT - Amplitude spectrum of shifted signal with sorted samples (from fig.14)
Inverse Fast Fourier Transform can be implemented by minor change in forward FFT method:
/// Calculates inverse Fast Fourier Transform of given spectrum
/// <param name="X">Spectrum values</param>
/// <returns>Signal samples</returns>
public Double[] iFFT(Complex[] X)
int E = (int)Math.Log(N, 2);
for (int e = 1; e < E + 1; e++)
int SM = (int)Math.Pow(2, e - 1);
int LB = (int)(Convert.ToDouble(N) / Math.Pow(2, e));
int LMB = (int)Math.Pow(2, e - 1);
int OMB = (int)Math.Pow(2, e);
Complex W = Complex.Exp(Complex.ImaginaryOne * 2 * Math.PI / Math.Pow(2, e)); // changed sign - our minor change
for (int b = 1; b < LB + 1; b++)
for (int m = 1; m < LMB + 1; m++)
int g = (b - 1) * OMB + m;
int d = g + SM;
Complex xgora = X[g - 1];
Complex xdol = X[d - 1] * Complex.Pow(W, m - 1);
X[g - 1] = xgora + xdol;
X[d - 1] = xgora - xdol;
x[i] = X[i].Real;
Fig.17. Signal restored from spectrum from fig.15 using inverse Fast Fourier Transform.
As it can be noticed, the signal complemented with additional zero samples is not without effect on the spectrum - at figures 15 and 16 additional stripes can be noticed. Nevertheless, while we keep them for futher calculations, we are able to restore the original signal.
However, let us see if we can still separate the signal from noise and restore it using FFT methods.
Firstly, remove stripes that are suspected of being a disturbance:
Fig.18. Filtred signal spectrum
Secondly, calculate inverse FFT
Fig.19. Inverse FFT - restored signal
Thirdly, cut additional samples
Fig.20. Signal without additional samples.
At the end, compare original (undisturbed) signal with our filtration result.
Fig.21. Original and output signal comparison (Fast Fourier Transform).
All signal processing algorithms presented in this article are implemented in attached source code. To start working with DiscreteFourierTransform library simply declare its namespace:
using DiscreteFourierTransform;
DiscreteFourierTransform.DiscreteFourierTransform dft = new DiscreteFourierTransform.DiscreteFourierTransform();
and start your adventure with digital signal processing in frequency domain.
Library methods and applications
Disturbed sine signal and samples indexes are included in dll:
Double[] signal = dft.testsignal();
int[] n = dft.testsignalindexes();
// --- Discrete Fourier Transform by definition
Complex[] X = dft.DFT(signal); // discrete fourier transform by definition
Double[] A = dft.Amplitude(X); // amplitude spectrum from X
Complex[] Xa = dft.DFT(signal, n); //discrete fourier transform by definition with samples numbers
Double[] signal2 = dft.Shift(signal); // Signal shift method
Complex[] Xb = dft.DFT(signal2); // discrete fourier transform by definition of shifted signal
// Compare Xa and Xb and see if we were correct!
// --- Inverse Discrete Fourier Transform by definition
Double[] x = dft.iDFT(X); // inverse discrete fourier transform by definition
Double[] xa = dft.iDFT(Xa, n); // inverse discrete fourier transform by definition (with samples numbers)
Double[] xb = dft.iDFT(Xb); // inverse discrete fourier transform by definition of shifted signal
// Compare x, xa and xb. Any other operation needs to be performed at xb to restore original?
Discrete Fourier Transform with reduced number of calculation
// --- Discrete Fourier Transform with reduced number of calculation
Complex[] X2 = dft.DFT2(signal); // discrete fourier transform with reduced number of calculation
Complex[] X2a = dft.DFT2(signal, n); // discrete fourier transform with reduced number of calculation with samples numbers
Complex[] X2b = dft.DFT2(dft.Shift(signal), n); // discrete fourier transform with reduced number of calculation (shifted signal)
Signal pack with zeros
// Signal pack with zeros
Double[] signalpack = dft.SignalPackRight(signal); // Complement at right to N = nearest power of 2
Double[] signalpack2 = dft.SignalPackLeft(signal); // Complement at left to N = nearest power of 2
Double[] signalpack3 = dft.SignalPackBoth(signal); // Complement at both sides to N = nearest power of 2
Samples sorting
// Samples sorting
Double[] signal3 = dft.FFTDataSort(signalpack); // using bit reverse
Double[] signal4 = dft.FFTDataSort2(signalpack); // using shift method
// Compare signal3 and signal4 - should be equal!
Complex[] X3 = dft.FFT(signal3); // fast fourier transform
Complex[] X3a = dft.FFT(dft.Shift(signal3)); // shifted spectrum - fast fourier transform
Spectrum stripes sorting
Complex[] X3s = dft.FFTDataSort(X3); // spectrum sort using bit reverse
Complex[] X3as = dft.FFTDataSort2(X3); // spectrum sort using shift method
Double[] x3 = dft.iFFT(X3s); // inverse fast fourier transform
// ----------------- Compare x3 with signal!!! ---------------
8-Mar-18 8:51
It is again an excellent article from you.
I have also red from you "Fundamentals of Image Processing".
Also a great stuff. It helped me a lot to understand the things about Image Processing.
But I've got a question to this article.
The function " public Complex[] DFT(Double[] x)" works very well an gives me back an array with complex numbers.
But I'm not able to create a graph with that complex numbers.
Do you have a sample or a link for such a graph?
BillW3312-May-17 7:25
BillW33 12-May-17 7:25
Darryl Bryk5-Jan-17 11:08
Darryl Bryk 5-Jan-17 11:08
I've tried to use your code and the DFT works fine, but was unable to get the FFT working correctly. The resulting graphs turn out to have peaks at many freq's. After trying some other code found elsewhere, I think its because I didn't prepare the data correctly with the other functions (e.g. FFTDataSort, Shift, Amplitude, ...). Your article, however, doesn't explain very well how the calls to the functions should be made, when, and in what order, nor does your downloaded code show usage.
Since my data in not a multiple of 2 I did pad the data with zeroes before using the FFT.
Perhaps you can add some explanation, or at least show in the code samples, how to make the function calls.
software to draw graphics
avecchi197327-Apr-16 21:30
avecchi1973 27-Apr-16 21:30
which software do you use to draw graphics?
Re: software to draw graphics
Jakub Szymanowski28-Apr-16 21:21
Jakub Szymanowski 28-Apr-16 21:21
If you mean diagrams - ms visio, if you mean plots - ms excel. No, I didn't draw Fouriers portrait by myself
avecchi19731-May-16 22:32
avecchi1973 1-May-16 22:32
ok thank you, you wrote a very interesting post.
avecchi19732-May-16 3:06
avecchi1973 2-May-16 3:06
could you send me the excel, I'd like to use as a template.
Jakub Szymanowski4-May-16 0:11
Jakub Szymanowski 4-May-16 0:11
John Underhill14-Apr-16 6:12
John Underhill 14-Apr-16 6:12
Well presented and detailed explaination..
D V L7-Apr-16 20:59
D V L 7-Apr-16 20:59
Cybercockroach14-Mar-16 16:54
Cybercockroach 14-Mar-16 16:54
you got my 5. I like this type of article. From basic theory to implementation. Great.
BTW, it seems that there are some typos on the butterfly chart.
the odd sample indices should be from 0,1,2,3 not 1,2,3,3??
Jakub Szymanowski14-Mar-16 22:34
Jakub Szymanowski 14-Mar-16 22:34
Thanks. Both, for your comment, and for mistake indication. You're right, should be 0,1,2 and 3. Promise to fix it next time, as I revisit this text.
glennPattonWork10-Mar-16 0:09
glennPattonWork 10-Mar-16 0:09
Gets my 5! Had to battle with Fourier a lot during my degree, only paid it 'enough' attention to get through exams. Always interested me though I will have a further detailed read when I get the chance! Thanks!
References for detailed EXPLANATION of WHAT the transform is
jhog9-Mar-16 6:02
jhog 9-Mar-16 6:02
Two wonderful expositions as to WHAT this transform is:
Both are eminently accessible, as opposed to formal mathematical books that are either put down after 5 minutes (for those who are comfortable with math theory) or 5 seconds (for the rest of us).
Communication Systems Hardcover – March, 1968
The first 90 pages are exclusively devoted to explaining - NOT "telling" what the Fourier transform is, where it comes from starting from an analogy with vectors. Still available rock-bottom prices from Amaz...
Yes, from a language school catering to children. Starts from very low and slowly working up to the point.
modified 9-Mar-16 13:42pm.
mrmike8-Mar-16 7:02
mrmike 8-Mar-16 7:02
You rocked it. Very complete, I enjoyed reading it.
Kenneth Haugland7-Mar-16 10:18
Kenneth Haugland 7-Mar-16 10:18
Have some (hopefully interesting) remarks, though:
The Fourier transform was actually first suggested to solve PDE by Daniel Bernoulli in 1753 for vibrating strings, but it was only theoretical, he didn't calculate anything. The solution was however dismissed by Euler, and the problems he was concerned about wasn't really solved until the 1850's by Riemann and Weierstrass. The reason that it's called Fourier transform is that Fourier presented a solution for calculating the coefficients, and thereby giving a seemingly correct solution to the problem, so his paper couldn't be dismissed like Bernoulli's. You could read more about this in the book "A radical approach to real analysis".
The Cooley-Tukey algorithm is actually quite old and was originally discovered by Gauss, they just happen to rediscover it and implement it on a computer. And according to "Numerical recipes in C++" the popularity of the FFT is mainly due to the speed improvements of this non-trivial algorithm, people go head over heels to find a way to use it, just because it's so fast.
I also think there is a slight mistake in the sampling theorem, although it seem to be a standard practice to say that it has to be twice as much or higher. I actually think that it must be higher if it's exactly twice, you'd loose information. A simple example to illustrate the problem would be a wheel rotating at 1 Hz. If you sampled 2 Hz, the values would be sampled at 0, Pi, 2Pi ... etc, you couldn't know what direction the wheel was turning, if you however did (2 + dt) Hz, you'd know what way the wheel would turn. Don't have the formal mathematical proof though.
Re: I really liked this one
Jakub Szymanowski7-Mar-16 22:03
Jakub Szymanowski 7-Mar-16 22:03
you are absolutely right when it comes to historical outline, I did not mean, that the tenor of what I wrote was heavily descriptive. However, I am very impressed by the knowledge of the history of mathematics - the more that I believe that the knowledge of this adds to its "human" face.
When it comes to sampling theorem, then I have a moment to think about what I wrote - certainly appeal even in this case.
Kenneth Haugland8-Mar-16 0:45
Kenneth Haugland 8-Mar-16 0:45
Jakub Szymanowski wrote:
I think that it is articles like this one, showing how a mathematical algorithm work and how to program it, is very useful. I would even say that it is more precise that just the mathematical expressions (they require you to be fluent in the mathematical language), as you see the step by step process of how it is implemented.
The history behind mathematics if often very much more complicated than people usually think. The story is often a progression of events that had contributions from many different people, and we tend to give the names of it to the one that made it common knowledge. I think that the background story, as you say, makes it more human and more interesting, and it' not to criticize your article, it's just something that I knew and thought you/others might find interesting.
Jakub Szymanowski8-Mar-16 2:18
Jakub Szymanowski 8-Mar-16 2:18
I never took it for criticism, so do not worry that offended me good to know that people are looking for here is not only simple answers, but also want to know all the aspects of the problem.
Jakub Szymanowski8-Mar-16 10:19
Jakub Szymanowski 8-Mar-16 10:19
I spent sometime thinking about your doubt and I have good and bad news. The good one is that the sampling theorem is still correct in all range. The bad one, for two of us and rest people in the world, is that we still can not turn back time... (despite last year of Einstein theory). The point is you're looking for the answere in wrong place. Let's imagine that wheel, and a certain point at its edge. Although, the point can move left or right, from out perspective (signal theory), we still can see only its change of value in time. Here's a really nice animation, I found at wikipedia: File:Fourier series square wave circles animation.gif - Wikipedia, the free encyclopedia[^]
No matter if the position of our point changes clockwise or counterclockwise, the roll of paper (timeline) always expanding to the right.
To conclude, signal that your trying to digitalize is not a position (in the physical sense), but position changes in time.
What's more, even if we have increased our sampling frequency, it wouldn't help at all - from signal perspective, our point still mvoes only up and down.
The last word - consider your point's dynamic AS two time functions x(t) for horizontal change and y(t) for vertical change. Sample both of them and look at the results together - should answere your problem.
modified 8-Mar-16 17:20pm.
Kenneth Haugland9-Mar-16 1:39
Kenneth Haugland 9-Mar-16 1:39
I don't think so actually, remember that Fourier transform is used to recreate a line with different frequency coefficients. The animation is just a visualisation of the superposition of several waves to create this line, and it continues indefinitely. This means that you have indeed connected the end and the beginning of the signal together in some way.
If you take sampling theorem at face value, it will be able to recreate any signal with if sampling frequency fs is 2*frequency you are interested in. That might be true, what I'm claiming is that it has to be above fs > 2*frequency otherwise information will be lost. Like this: Why car wheels rotate backwards in movies - YouTube[^]
Michael D Bray14-Mar-16 7:17
Michael D Bray 14-Mar-16 7:17
Note - see the "UPDATE" at the bottom.
It's been a ***LONG*** time since I've looked at the math of FT... But I remember asking myself this very same question when I was at university, and as I recall, my conclusion was that the sampling theorem is correct because it deals with the frequency of cyclic signals, not the phase of individual frequency components.
What I mean is... if you have a finite-duration sinusoidal signal, then what this really amounts to is an infinite-duration signal for which the values are 0 once you get past the "real signal". The spectrum of such a signal will have components of arbitrarily high frequency. Thus in order to faithfully reproduce this signal exactly, you would need an infinite sampling frequency. That's not what FT is designed to deal with.
On the other hand, if you consider the sinusoidal signal as a cyclic signal (repeating) then even if you sample at exactly 2x then the only "information" you have "lost" is the phase of the signal, which in a cyclic signal is virtually irrelevant. The sampling theorem says that since the signal is cyclic, it doesn't matter what phase shift is attributed to it. For example, let's say you sample sin(x) at 0, PI, and 2*PI, and you get 0, 0, and 0. It seems you have lost information. Well - even from those samples, you still can recover the frequency (it must have a period of 2*PI - any frequency higher than this is invalid conclusion because you would have violated the requirement of sampling at 2x the highest frequency)! Yes, the phase is ambiguous... Does the signal go up first (like sin) or does it go down first (like -1*sin)? Sampling theorem doesn't care - it says that the information of a cyclic signal is contained in the frequency, not the phase.
UPDATE: Actually you do lose some information - the magnitude of the frequency component, if you happen to sample exactly on the nodes of the highest frequency component. However, in a practice I think this is relatively rare (I'd even go so far as to say non-existent), and probably something that can generally be ignored for two reasons... (1) The further away from the nodes you happen to sample, the less of an issue it is (it depends on the precision of your sampling), and (2) a signal that has a high-intensity frequency component at the maximum frequency is going to be extremely chaotic and is likely to be the target of filtering anyway. In practice, sampling rates are always > 2*Fmax simply for padding due to imperfect knowledge of exactly what the highest signal frequency actually will be.
modified 14-Mar-16 14:10pm.
Kenneth Haugland14-Mar-16 8:45
Kenneth Haugland 14-Mar-16 8:45
I think we are saying the exact same thing here, at least, it seems that way to me.
Generally in math, if I find one example that it is wrong, it is not right. A typically Q.E.D. answer, if you will. I just found an example of where the Sampling theorem can't reproduce the signal, even if the sampling frequency is = 2*fmax. However, I don't know exactly the theorem is proven with mathematics.
I also agree with you that this is purely a theoretical discussion (there is something called Gibbes theorem as well), so you would never have this close call in practice.
Jakub Szymanowski14-Mar-16 23:02
Jakub Szymanowski 14-Mar-16 23:02
Hello Michael and Kenneth!
Michael, for the most part I agree with you. In my opinion, the point is we are trying to reproduce 2-D function having only one of them sampled.
Imagine that our point start its journey at the top of wheel - our y(t) signal starts with value 1, and all our samples are [1 -1, 1] for normalized time values [0, T, 2T]. In the case of synchronous sampling of horizontal signal (x(t)) we cannot tell anything about rotate direction, as our function x(t) is sampled with values [0,0,0] for the same normalized timestamps [0, T, 2T]. But if x(t) is sampled with shifted timebase our case seems be solved - in ideal case timestamps should be [0 + pi/2, T + pi/2, 2T + pi/2]. Therefore we can see samples values [1, -1, 1] or [-1, 1, -1] - depends on point rotate direction.
And one update. Why sampling at the same time gives an ambiguous answer? If we assume that center of our wheel is the orgin, sampling in the same time miss the information about sign as the relationship between variables is still y^2(t) + x^2(t) = radius.
Kenneth Haugland18-Mar-16 11:08
Kenneth Haugland 18-Mar-16 11:08
I found a derivation of the sampling theorem, see my new comment below.
Last Visit: 31-Dec-99 18:00 Last Update: 16-Oct-18 4:15 Refresh 12 Next »
Best "Everything Else" Article of March 2016 : First Prize
Web05-2016 | 2.8.180920.1 | Last Updated 7 Mar 2016
Article Copyright 2016 by Jakub Szymanowski

type: global

value: This website is a community for computer programmers with articles on different topics and programming languages such as web development, software development, C++, Java, and other topics. Once a visitor registers a user account on the site, they can gain reputation which allows users to unlock different privileges such as the ability to store personal files in the user's account area, have live hyperlinks in their profile biography, and more.


text:
nutellayummm comments on Tonight I made a BBQ portobello sandwich and smoked gouda - YUM!jump to contentmy subredditsannouncementsArtAskRedditaskscienceawwblogbookscreepydataisbeautifulDIYDocumentariesEarthPornexplainlikeimfiveFitnessfoodfunnyFuturologygadgetsgamingGetMotivatedgifshistoryIAmAInternetIsBeautifulJokesLifeProTipslistentothismildlyinterestingmoviesMusicnewsnosleepnottheonionOldSchoolCoolpersonalfinancephilosophyphotoshopbattlespicsscienceShowerthoughtsspacesportstelevisiontifutodayilearnedTwoXChromosomesUpliftingNewsvideosworldnewsWritingPromptsedit subscriptionsfront-all-random | AskReddit-funny-pics-todayilearned-gifs-videos-worldnews-news-gaming-aww-movies-Showerthoughts-explainlikeimfive-Music-IAmA-sports-Jokes-LifeProTips-tifu-mildlyinteresting-dataisbeautiful-DIY-food-space-personalfinance-television-nottheonion-science-photoshopbattles-askscience-TwoXChromosomes-Fitness-creepy-OldSchoolCool-books-EarthPorn-WritingPrompts-UpliftingNews-Futurology-Art-GetMotivated-nosleep-Documentaries-history-InternetIsBeautiful-gadgets-listentothis-philosophy-announcements-blogmore » vegetariancommentsrelatedWant to join? Log in or sign up in seconds.|Englishlimit my search to /r/vegetarianuse the following search parameters to narrow your results:subreddit:subredditfind submissions in "subreddit"author:usernamefind submissions by "username"site:example.comfind submissions from "example.com"url:textsearch for "text" in urlselftext:textsearch for "text" in self post contentsself:yes (or self:no)include (or exclude) self postsnsfw:yes (or nsfw:no)include (or exclude) results marked as NSFWe.g. subreddit:aww site:imgur.com dogsee the search faq for details.advanced search: by author, subreddit...this post was submitted on 29 Mar 201269 points (93% upvoted)shortlink: remember mereset passwordloginSubmit a new linkSubmit a new text postvegetariansubscribeunsubscribe44,050 readers~40 users here now Rules & Guidelines
a community for 7 yearsmessage the moderatorsMODERATORSantifolkherodrewsaysgovegEnchantressOfNumbersvegetarianDkPhoenixvegetarian 25+ yearshht1975vegetarian 25+ yearsabout moderation team »discussions in /r/vegetarian<>X118 points · 104 comments Are any of you vegetarians/vegans for purely environmental reasons?I'm doing some research on dietary restrictions and eating out. Please take my quick survey. <1 Minute47 points · 30 comments Slaughter free milk2 points Mushroom stroganoff6 points · 1 comment Crunchy Roasted Indian Masala Chickpeas4 points · 4 comments Most ethical way to purchase produce, and how to ensure your produce is ethically farmed?2 points · 2 comments Been dating a vegetarian looking for simple yet impressive recipes2 points · 8 comments Wondering why onions are not vegetarian76 points · 24 comments Since going vegetarian, this is my favoritate stock seasoning from my local shop. Wait a sec...7 points · 22 comments What are the best arguments AGAINST vegetarianism?This is an archived post. You won't be able to vote or comment.
686970Tonight I made a BBQ portobello sandwich and smoked gouda - YUM! (i.imgur.com)submitted 3 years ago by nutellayummmOvo Lacto Vegetarian13 commentsshareloading...sorted by: besttopnewcontroversialoldrandomq&ayou are viewing a single comment's thread.view the rest of the comments →[–]nutellayummmOvo Lacto Vegetarian[S] 1 point2 points3 points 3 years ago (1 child)I let the bellos marinate for an hour, while they marinated I put together the dry rub and the bqq slaw. Grilling the bellos only took about 10 minutes! It's super easy and the dry rub and bqq slaw last a while afterwards (a lot was left over).
permalinkembedsaveparentgive goldPosts are automatically archived after 6 months.Got Itaboutblogaboutvaluesteamsource codeadvertisejobshelpsite rulesFAQwikireddiquettetransparencycontact usapps & toolsAlien Blue iOS appmobile betabuttons<3reddit goldreddit storeredditgiftsUse of this site constitutes acceptance of our User Agreement and Privacy Policy (updated). © 2016 reddit inc. All rights reserved.REDDIT and the ALIEN Logo are registered trademarks of reddit inc.create a new accountusername:password:verify password:email: (optional)remember meget the best of reddit emailed to you once a week. learn moresign uplog inusername:password:remember mereset passwordlog inBy signing up, you agree to our Terms and that you have read our Privacy Policy and Content Policy.English [en]العربية [ar]Беларуская мова [be]български език [bg]Bosanski [bs]català [ca]česky [cs]dansk [da]Deutsch [de]Ελληνικά [el]English (Australia) [en-au]English (Canadian) [en-ca]English (Great Britain) [en-gb]English [en-us]Esperanto [eo]español [es]español [es-ar]eesti keel [et]Euskara [eu]فارسی [fa]suomi [fi]français [fr]Gàidhlig [gd]עברית [he]मानक हिन्दी [hi]hrvatski [hr]Magyar [hu]Հայերեն լեզու [hy]Bahasa Indonesia [id]íslenska [is]italiano (Italy) [it]日本語 [ja]ಕನ್ನಡ [kn_IN]한국어 [ko]Latin [la]1337 [leet]LOL [lol]lietuvių kalba [lt]latviešu valoda [lv]Nederlands [nl]Nynorsk [nn]Norsk [no]Arrrrrrrr! [pir]polski [pl]português [pt] (*)português [pt-pt]português brasileiro [pt_BR]română [ro]русский [ru]slovenčina [sk]slovenščina [sl]српски језик [sr]Srpski [sr-la]Svenska [sv]தமிழ் [ta]ภาษาไทย [th]Türkçe [tr]українська мова [uk]Tiếng Việt [vi]中文 [zh] (*) incomplete volunteer to translateπ Rendered by PID 6651 on app-309 at 2016-02-09 18:33:24.825912+00:00 running 84eeada country code: US.

value: This website is an American social news aggregation, web content rating, and discussion website. Registered members submit content to the site such as links, text posts, images, and videos, which are then voted up or down by other members.


text:
19800mAh 1/2" Electric Brushless Cordless Impact Wrench Drill High Torque SALE ! | eBay
See more 19800mAh 1/2" Electric Brushless Cordless Impa...
19800mAh 1/2" Electric Brushless Cordless Impact Wrench Drill High Torque New
19800mAh 1/2" Electric Brushless Cordless Impact Wrench Drill High Torque Tool
16800mAh 1/2'' Electric Brushless Cordless Impact Wrench Drill High Torque Tool
hotbid8088 (12033 )
Details about 19800mAh 1/2" Electric Brushless Cordless Impact Wrench Drill High Torque SALE !
Approximately £45.41(including postage)
US $10.00 (approx. £7.79) Economy Delivery | See details
6.0Ah 18V For Makita BL1860B REPLACE LXT Battery BL1850 BL1830 194230-4 Cordless
Milwaukee M18 Battery Adapter Convert to Dewalt DCB200 18V/20V Max Li-ion Batter
2x For Milwaukee 48-11-2420 M12 LITHIUM Compact Battery pack 48-11-2402 3500mAh
323832205787
Last updated on 14 Nov, 2019 14:05:09 GMT View all revisions
Rotating speed: 0 - 3200 r/min MPN: Does Not Apply
Bit Holder: 1/2" Bundle Listing: Yes
color: red Input: 110V-220V 50Hz
Type: Impact Wrenches Battery Capacity: 168V 19800mAh
Battery Included: Yes Torque: 320 Nm
Voltage: 110V-220V UPC: Does not apply
Feedback on hotbid8088 from others who bought this item
Back to home page | See more details about "19800mAh 1/2" Electric Brushless Cordless Impact Wrenc..." Return to top
19800mAh 1/2" Electric Brushless Cordless Impact W... 19800mAh 1/2" Electric Brushless Cordless Impact W...
Panasonic Brushless Cordless Drills,
Hitachi Brushless Cordless Drills,
Erbauer Brushless Cordless Drills,
Ryobi Brushless Cordless Drills,
JCB Brushless Cordless Drills,
Einhell Brushless Cordless Drills,

value: This website is an American multinational e-commerce corporation based in San Jose, California, that facilitates consumer-to-consumer and business-to-consumer sales through its website.


text:
GERMAN ARMY PARA BOOTS MK7 2000 ISSUE - SECURITY CAMPING HIKING WORKWEAR £69.99	+ more options
Genuine German Army Para Boots Grade 1
GENUINE GERMAN ARMY PARA BOOTS MK 4 # NEW VIBRAM SOLES #
*NEW* GENUINE ISSUE BLACK LEATHER Mk6 GERMAN ARMY PARABOOTS, 265 / UK7.5 combat £69.00
£69.99	GERMAN ARMY PARA BOOTS /COMBAT BOOTS MK7 2000 -SIZE 11-NEW IN BOX
£69.99	German Army Para Boots - Grade 1 Excellent Condition £29.99	+ more options
GENUINE GERMAN PARA FALLSCHIRMJAGER FJ COMBAT BOOTS black FALKLANDS AIRBORNE £24.99
Genuine German Para Boots,grade 2, mark 4 type
Super grade Genuine German Army Issue Tropentarn Desert Combat Shirt Vintage
UK BRITISH ARMY SURPLUS MTP HELMET COVER WILL FIT MK.6 KEVLAR OR PARA S-L-SAS/RM
Genuine German Army Black Leather & Fur Lined Motorcycle Jack Boot - Size 7 NEW
German Army Para Boots - Grade 1. TA, Cadets, CCF, ACF £34.90	+ more options
German army military surplus general purpose steel toe cap work boot
£61.19	+ more options
£34.99 to £340.99	+ more options
German Army Black Leather & Fur Motorcycle Jack Boot 7½
GENUINE GERMAN ARMY MARK 5/6, MODEL 2007 PARA COMBAT BOOTS,BRAND NEW IN BOX!!!!
Genuine German Army Black Leather & Fur Motorcycle Jack Boot - UK Size 8 - NEW
Genuine German Army Black Leather Motorbike / Jack / Riding Boot UK size 9 - NEW
German Army Norgie Thermal Undershirt Amry Surplus Tight Fit, Grade 1, size 7/44
£56.19	+ more options
GENUINE BRITISH ARMY LOWA COMBAT BOOTS - GRADE 1 - SIZE UK 7
Genuine German Army BW Grey Officers Lined Trench Coat - GRADE 1 USED £19.99	+ more options
Super Grade Genuine German Army Issue Flecktarn Woodland Winter Fur lined hat


text: Patent US8123810 - Expandable intervertebral implant with wedged expansion member - Google PatentsSearch Images Maps Play YouTube News Gmail Drive More »Sign in<nobr>Advanced Patent Search</nobr>PatentsAn expandable intervertebral implant is described for insertion between vertebrae of a human spine. The intervertebral implant includes an upper body that engages a first vertebra of the human spine, a lower body that engages a second vertebra of the human spine, an insert, and an expansion member. The...http://www.google.com/patents/US8123810?utm_source=gb-gplus-sharePatent US8123810 - Expandable intervertebral implant with wedged expansion memberAdvanced Patent SearchPublication numberUS8123810 B2Publication typeGrantApplication numberUS 11/134,069Publication dateFeb 28, 2012Filing dateMay 20, 2005Priority dateAug 5, 2003Also published asUS7708778, US7753958, US8118870, US8118871, US8147550, US8172903, US8257440, US8647386, US20050209698, US20050273171, US20050273173, US20050273174, US20050273175, US20050278026, US20050283244, US20050283245, US20050283247, US20050283248, US20100331985, US20120310349Publication number11134069, 134069, US 8123810 B2, US 8123810B2, US-B2-8123810, US8123810 B2, US8123810B2InventorsCharles R. Gordon, Corey T. Harbold, Heather S. HansonOriginal AssigneeGordon Charles R, Harbold Corey T, Hanson Heather SExport CitationBiBTeX, EndNote, RefManPatent Citations (101), Non-Patent Citations (130), Referenced by (3), Classifications (88), Legal Events (1) External Links: USPTO, USPTO Assignment, EspacenetExpandable intervertebral implant with wedged expansion memberUS 8123810 B2Abstract An expandable intervertebral implant is described for insertion between vertebrae of a human spine. The intervertebral implant includes an upper body that engages a first vertebra of the human spine, a lower body that engages a second vertebra of the human spine, an insert, and an expansion member. The expansion member may include a first angled portion and a second angled portion. The expansion member may be advanced such that a first angled portion of the expansion member engages an angled portion of the insert to increase a separation distance between the upper body and the lower body of the intervertebral implant. An advancing element may engage a second angled portion of the expansion member such that a direction of advancement of the advancing element is different than the direction of advancement of the expansion member.

value: This website is a search engine provided by Google. Handling over 3.5 billion searches per day, it has a 92% share of the global search engine market.