Solving linear equation in octave

Create a matrix for linear equations :

2X+4Y+5Z=1, 3X+6Y+7Z=2 and 4X+7Y+8Z=3

>> A = [2 4 5; 3 6 7; 4 7 8]     // Enter values of equations in a matrix form
A =

2   4   5
3   6   7
4   7   8

>> B = [1 2 3]     // Create second matrix of constant values
B =

1   2   3

>> B’      // Transpose to convert row matrix to column matrix
ans =

1
2
3

>> B”    // Double transpose, to convert transposed matrix again to its original form
ans =

1   2   3

>> X = A/B    // To find the values of x, y and z
X =

1.7857
2.5714
3.0000

2

Advertisements

Published by

kaurdavinder

I am the one who discover myself daily through reading, writing, interacting with people and expressing my thoughts to inspire them if I would be able to bring a little change to the society through my work. I write blogs, participate in various social activities and want to be a Professional Speaker. Currently, I am pursuing my post graduation in Computer Applications from Guru Nanak Dev Engineering College, Ludhiana and I’m very much active in many technical & social communities.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s