Tuesday, July 17, 2012

Real-time signal drawing

I want to introduce simple Java program that performs real-time signal drawing. It based on Model-View-Controller (MVC) framework. I wrote a post about  MVC usage by very simple example.
 
At first, we create a Buffer class, where incoming samples (came from some abstract source) are stored. The idea of how Buffer handles data is shown on Fig.1. The iWrite (iW) index points to cell were new sample is stored. Denote this sample s[0]. The sample that has came before s[0] becomes s[-1], sample before it becomes s[-2] and so on. After new sample saved, the iRead (iR) index increments subsequently to read all samples from newest to oldest to redraw signal on screen. We increment iR to read from s[0] to s[-6]. Repeat that procedure we draw the signal that slide along the screen from right to left.

Thursday, July 12, 2012

FIR filter programming and testing

About FIR (finite impulse response) filter programming in C I have written in my old post. Now I want to show the object-oriented programming approach to solve this task using Java. 

Also there is some improvements: the cyclic buffer is used to convolve filter kernel with  input data samples. It reduces the number of calculations, because there is no need to shift all input data through array where data stored. You just have to put input sample in write place and shift array index (or "pointer" to element).

Monday, February 20, 2012

Electrical impedance tomography - My current results

I want to introduce current results in EIT imaging study that are obtained by me. The developed model, algorithms (that are became the heart of written software) and EIT acquisition system were used to get images on artificial phantom. The Matlab was used to implement the reconstruction algorithm and C++/Java were used to write software to collect data from hardware acquisition system.
The finite element model of object under investigation is showed on Fig.1. The 2-D representation of flat container of round shape was used. It consists of 97 nodes and 160 elements. The 16 electrodes that can be used for measurement or current applying are placed surround the object. The 182 observations were collected.

Saturday, February 11, 2012

Electrical impedance tomography (Part IV) - Jacobian

In EIT problem solving it is necessary to calculate the derivatives of the measured voltages respect to conductivity. Complete matrix of partial derivatives is called the Jacobian, sometimes called the sensitivity matrix and its rows are called sensitivity maps [1].
Jacobian - the matrix of the sensitivity of the voltage across the electrodes to the change in electrical conductivity within the object in the application of different current patterns.


Sunday, January 29, 2012

Linear circuit investigation using FFT

The Fourier analysis is very powerful and useful instrument of investigation that is used widely in many scientific applications. It named after French mathematician Joseph Fourier who proved that arbitrary signal can be represented by sum of harmonic signals. Each harmonic signal (sinus or cosines) has own frequency, phase and amplitude. Нarmonic signal keeps its shape while passing through the linear circuit and change only amplitude and phase. This ability makes the Fourier analysis to become a power method of investigation. To perform Fourier analysis on computers in digital form the Discrete Fourier Transform (DFT) was developed. The fast optimized version of DFT is called Fast Fourier Transform (FFT).

Saturday, January 28, 2012

Electrical impedance tomography (Part III) - The nonlinear model

The nonlinear model of EIT will be discussed. To obtain a tomographic image of the object a matrix of electrodes is superimposed on it's surface and series of measurements are produced. 
During the one measurement through the current electrodes the current is passed, while from measurement electrodes the potentials are measured relative to a reference electrode. This procedure is repeated with new current electrodes more and more to obtain dataset of observations.

Wednesday, January 25, 2012

Simple Java MVC for Google App Engine

Using heavy Java frameworks on Google Application Engine (GAE)  is painful: after some time, when you website gets no incoming requests, GAE stops Java Virtual Machine (JVM). After that to processing new request JVM has to start again and has to start the Framework. Unfortunately Java EE frameworks have doing some initialization process, that takes much time. I tried to use great Play!Framework and Spring Framework but slow "cold start" and slow working forced me to find another solution for implementing MVC for my projects.
I'm going to describe how to write simple MVC framework using plain Java HttpServlets and FreeMarker that can run fast in GAE, doesn't have slow "cold start" and much CPU time consuming.
For my project I used Eclipse Java EE IDE (Indigo Release). I had installed Google Plugin for Eclipse
to make GAE applications development faster and easier.

Wednesday, January 18, 2012

FIR filter implementation

FIR (finite impulse response) filter is a digital filter without feedback. Absence of feedback makes impulse filter response to be finite. Digital filters can be with infinite impulse response (IIR filters).
The advantages of FIR filters compared to IIR filters:
1. FIR filter can be designed with linear phase.
2. FIR filter is simple to implement.

Sunday, January 15, 2012

Solving ordinary differential equations


How to solve systems of linear differential equations? Here we describe three ways: Runge - Kutta method, and two similar ways to each other using the method of state space.

Let our process is described by the following differential equation:

Electrical impedance tomography (Part I)

Electrical impedance tomography (EIT) is a method of imaging the spatial distribution of conductivity inside the object (in particular human organs), by measuring the voltage on its surface. This voltage is excited by small current that flows through the object in various combinations. EIT is based on fact that different areas inside the object under investigation have different conductivity, thereby current flow changes its direction. That effect leads to boundary potential changes, that can be detected.

Electrical impedance tomography (Part II) - The physical principle


The classical forward problem is to find the output response of the model due to the input impact. The model and input signal we know.
Such problems are correct in the sense of Hadamard [1], for which:
1) a solution exists for all input signals;
2) the solution is unique;
3) the solution depends continuously on the input data.
Physical problems that satisfy the conditions of existence of solution, its uniqueness and stability are correct. The solution of such problems are not sensitive to small changes (errors) of input data [2].

Saturday, January 14, 2012

Fast Fourier Transform (FFT) simple usage

How to build spectrum of signal? Here is simple, but detailed example of Matlab's fft() function usage. Also I showed how correctly plot discrete time signal and discrete spectrum of signal.

Friday, January 13, 2012

Model-View-Controller (MVC) pattern simple example

About this architectural pattern is so much articles have been written, so I don't describe it in details. Follow MVC in Wikipedia link to read about theory of MVC. I just want to represent a very simple implementation of MVC pattern using Java and Swing library.