0% found this document useful (0 votes)
27 views1 page

Lab 1 Part 2

The document contains MATLAB code that performs linear algebra operations. It defines matrices f, g, and calculates h as the solution to the linear system f*h=g. It then defines matrix a, fixes a dimension error, and defines vector b. It calculates the solution x to the linear system a*x=b.

Uploaded by

johnyrock05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Lab 1 Part 2

The document contains MATLAB code that performs linear algebra operations. It defines matrices f, g, and calculates h as the solution to the linear system f*h=g. It then defines matrix a, fixes a dimension error, and defines vector b. It calculates the solution x to the linear system a*x=b.

Uploaded by

johnyrock05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

2/13/16 7:53 PM

MATLAB Command Window

1 of 1

>> f=[1 1 1 1; 2 -1 0 1; 3 1 -1 -1; 1 -2 -3 1];


>> g=[4; 2; 2; -3];
>> h=(g'/f')'
h =
1.0000
1.0000
1.0000
1.0000
>> a=[2 1 -4 6 3 -2; -1 2 3 5 -2 0; 1 -2 -5 3 2 1; 4 3 -2 0 1; 3 1 -1 4 3 6; 5 2 -2 3 1
1];
??? Error using ==> vertcat
CAT arguments dimensions are
not consistent.
>> a=[2 1 -4 6 3 -2; -1 2 3 5 -2 0; 1 -2 -5 3 2 1; 4 3 -2 2 0 1; 3 1 -1 4 3 6; 5 2 -2
3 1 1];
>> b=[16; -7; 1; -1; -11; 5]
b =
16
-7
1
-1
-11
5
>> x= (b'/a')'
x =
2.0000
-1.0000
1.0000
0.0000
3.0000
-4.0000
>>

You might also like