Friday 28 September 2007

My First Matlab Program

My lecture in this semester is Numerical Methode. And this lecture have a work practical in laboratorium Computation. The program that we use is Matlab. This is my first time to use matlab. And this is my first program on matlab :
clear all
clc

% disp is the tools to display string if you run your program
disp('My First Program')

% Creating matrix A (4X4)
A=[0 -1 -2 -3 ; 1 1 4 4 ; 1 3 7 9 ; -1 -2 -4 -6]

% Creating matrix B (1X4)
B=[0 ; 7 ; 4 ; 6]

% inv is the tools matlab to calculating the invers matrix A
M=inv(A)

% command to multiply matrix M with matrix B
x=M*B

% the result of the x on top and bellow is same
% because x is representating solution the system of linear equations
x=A\B

Note : % is give comment in your program. And it is not display when you run your program

0 Comment:

Design by Dzelque Blogger Templates 2008

Design by Dzelque Blogger Templates 2008