Manual DFT and IDFT Implementation in MATLAB/Octave

Implementing DFT and IDFT Manually in MATLAB/Octave

This document provides the complete MATLAB/Octave code for generating a sinusoidal signal, calculating its Discrete Fourier Transform (DFT) manually, and then reconstructing the original signal using the Inverse Discrete Fourier Transform (IDFT).

1. Signal Setup and Initialization

We begin by clearing the workspace and defining the time vector and the sinusoidal signal. The code uses 1-based indexing typical of MATLAB/Octave.

clear all;
clc;
close 
Read More

Data Structures and Algorithms C Implementation

Counting Nodes in a Singly Linked List

int count(struct node *p) {
    int c = 0;
    while(p) {
        c++;
        p = p->next;
    }
    return c;
}

Postfix Expression Evaluation

Given values: A=2, B=10, C=4, D=1

i) AB–CD*

  • Substitute: 2 10 – 4 1 *
  • Step 1: 2 – 10 = –8
  • Step 2: 4 * 1 = 4
  • Final Result: –4

ii) ABC–*

  • Substitute: 2 10 4 – *
  • Step 1: 10 – 4 = 6
  • Step 2: 2 * 6 = 12
  • Final Result: 12

Graph Theory Definitions

  • Bridge: An edge whose removal increases the number of connected components.
  • Cyclic
Read More

Neural Network Architectures and Learning Concepts

Feedforward Neural Network (FNN)

A Feedforward Neural Network is the simplest type of artificial neural network in which information flows in only one direction, from the input layer to the output layer. There are no feedback connections or loops.

Basic Structure

  • Consists of an input layer, one or more hidden layers, & an output layer.
  • Data flows from input → hidden → output.

Single-layer Feedforward Network

Has an input layer & an output layer only. The output layer performs the main computation

Read More

Data Visualization Principles and Web Implementation

Visualization Fundamentals

The ability to analyze data, process it, extract value, visualize it, and communicate it is an extremely important skill, given the ubiquitous availability of data today. The primary goals of visualization include:

  • Recording information.
  • Analyzing data to support reasoning, such as confirming hypotheses (e.g., John Snow’s work during the London Cholera Outbreak in 1854).
  • Communicating ideas to others.

Visualization functions effectively by addressing the fundamental limitations

Read More

Data Structures and Algorithms Concepts Explained

1. Algorithm Fundamentals

Definition and Characteristics of an Algorithm

An algorithm is a structured step-by-step procedure designed to solve a specific problem efficiently and correctly.

  • Input Requirement: It may accept zero or more input values that provide necessary data for producing meaningful results.
  • Output Requirement: It always produces at least one definite output representing the final answer of the computation.
  • Finiteness Property: Every valid algorithm must complete execution after a limited
Read More

Sorting Algorithms, Inversion Counting & Complexity

Hybrid Merge-Insertion Sort

[2-1 Hybrid Merge-Insertion Sort]

Stops recursion when a subarray size ≤ k and uses insertion sort for that subarray; MERGE is unchanged.

Pseudocode

INSERTION_SORT(A, p, r)
  for j = p+1 to r
    key = A[j]
    i = j - 1
    while i >= p and A[i] > key
      A[i+1] = A[i]
      i = i - 1
    A[i+1] = key

HYBRID_MERGE_SORT(A, p, r, k)
  if r - p + 1 <= k
    INSERTION_SORT(A, p, r)
  else if p < r
    q = floor((p + r) / 2)
    HYBRID_MERGE_SORT(A, p, q, k)
Read More