lecture3
lecture3
Lecture 3
20 mln
Systems of linear equations
x + 2y = 4,
2x − y = 3.
Systems of linear equations
y=
1
Systems of linear equations
y=
1
Systems of linear equations
The % symbol is a flag that indicates all information to the right is not
part of the command.
Systems of linear equations
>> matrix = [1 2 3; 4 5 6]
To Edit data:
Assign a value to a certain position in a
matrix
Example: matrix(2,3) = 100
To Delete a row :
Matrix(9,:) = [];
Example: delete Column 4 of your matrix
Systems of linear equations
x1 − 2x2 + 3x3 =4
2x1 − 5x2 + 12x3 = 15
2x2 − 10x3 = −10,
Ax = b
Systems of linear equations
Ax = b
In Matlab the standard way to solve a system Ax
= b is by the command:
>> x = inv(A)*b
or
>> x = A\b
We can do the above computations as follows:
>> A = [1 -2 3 ; 2 -5 12 ; 0 2 -10]
>> b = [4 15 -10]'
>> x = A\b
Systems of linear equations
5 ton 4 7 5
Sheet
Q1
1 1 2 3
F8
2 7 ton
F9 F10
In the problem above
1. How many equations will be generated?
b)
y 1500 1220 1050 915 810 745 690 620 520 480 410 390
Curve Fitting
>> cftool
ans =
7
Symbolic matrix
Try the following
>> clear; x=sym(‘x’); y=sym(‘y’);
>> f(x,y) = x^2+3*y;
>> s=f(1,2)
s=
7