Senin, 12 Januari 2009

Matlab Script for Gauss Elimination

Gauss Elimination is one method to solve linear equation system. From linear equation system is made a matrix that consist a number of coeffisien unknown variable and their constant. This matrix is changed to upper/lower triangle matrix... and is changed one more to identity matrix. this process is shown above:

From this linear equation system we got matrix above:

This matrix must be a triangle matrix :
And must be an identity matrix :
I have ascript to make a diagonal matrix, that shown above:

And more script to make an identity matrix

Minggu, 16 November 2008

Image compression with Run Length Encoding (RLE) Algorithm

Before it, i made a script about image compression use quantization algorithm. This algorithm is lossy compression, it means we can't decompression our image file after compression.
With RLE algorithm we can save all information in our image.... so nothing to loss. How RLE algorithm work? I will use 6x6 pixel grayscale image (8 degree grayscale) below:
1 1 1 7 1 3
4 4 6 1 2 2

7 7 7 5 5 5
6 4 4 2 2 2
5 5 2 2 2 1

2 3 3 3 0 0

RLE code is a number that contains color intensity and frequency of color intensity coming. Here, we get RLE code below:
1 3 7 1 1 1 3 1 4 2 6 1 1 1 2 2 7 3 5 3 6 1 4 2 2 3 5 2 2 3 1 1 2 1 3 3 0 2

And here source code to make RLE code.... that made with Matlab.
g is grayscale image. And RLE code in rle array. So we can decompression with very easily, because we save all information about image.

Jumat, 31 Oktober 2008

Solution of Linear Equation System with Cramer Method

Actually to get solution of Linear Equation System, we can do it very easy with Matlab. But, remember if in the past we studied Crammer Method for this. Crammer method given in below :
From that method we can arrange an algorithm :
One : input A and B matrix.

Two : We must know dimension of matrix, because matrix A mus be square and matrix B is one column matrix that sum of row equal to matrix A.

Three : We also must know determinat matrix, because matrix A is not singular.
Four : Find matrix A1 until An, and determinat it self.