Professional Documents
Culture Documents
Midter
Midter
1 Provide yourself with a unique ten equations in ten unknowns whose values of the
unknowns are all whole numbers which can either be positive or negative. Solve this set of
equations using Matlab command window and Matlab Editor creating m-file.
2a + 3b + 4c + 5d + 6e + 7f + 8g + 9h + 10i + j = 9
2a - 4b - 6c - 8d - 10e - 12f - 14g - 16h - 18i - 20j = 18
2a + 3b + 6c + 9d + 12e + 15f + 18g + 21h + 25i + 27j = 21
4a + 8b + 12c + 16d + 20e + 24f + 28g + 32h + 36i + 40j = 24
5a + 10b + 15c + 20d + 25e + 30f + 35g + 40h + 45i + 50j = 27
6a + 12b + 18c + 21d + 24e + 27f + 30g + 33h + 36i + 40j = 30
a + b + c + d + e + f + g + h + i + j = 33
7a + 14b + 21c + 28d + 35e + 42f + 49g + 56h + 63i + 70j = 36
8a + 10b + 12c + 14d + 16e + 18f + 20g + 22h + 24i + 26j = 40
9a + 12b + 15c + 18d + 21e + 24f + 27g + 30h + 33i + 36j = 50
A=
2 3 4 5 6 7 8 9 10 1
m-file
clc;
disp('Systems of Equations');
eqn1 = ('2*a + 3*b + 4*c + 5*d + 6*e + 7*f + 8*g + 9*h + 10*i + j == 9');
eqn2 = ('2*a - 4*b - 6*c - 8*d - 10*e - 12*f - 14*g - 16*h - 18*i - 20j == 18');
eqn3 = ('2*a + 3*b + 6*c + 9*d + 12*e + 15*f + 18*g + 21*h + 25*i + 27j == 21');
eqn4 = ('4*a + 8*b + 12*c + 16*d + 20*e + 24*f + 28*g + 32*h + 36*i + 40j == 24');
eqn5 = ('5*a + 10*b + 15*c + 20*d + 25*e + 30*f + 35*g + 40*h + 45*i + 50j == 27');
eqn6 = ('6*a + 12*b + 18*c + 21*d + 24*e + 27*f + 30*g + 33*h + 36*i + 40j == 30'); eqn7 = ('a + b + c + d + e +
f + g + h + i + j == 33');
eqn8 = ('7*a + 14*b + 21*c + 28*d + 35*e + 42*f + 49*g + 56*h + 63*i + 70j == 36'); eqn9 = ('8*a + 10*b + 12*c +
14*d + 16*e + 18*f + 20*g + 22*h + 24*i + 26j == 40'); eqn10 = ('9*a + 12*b + 15*c + 18*d + 21*e + 24*f + 27*g +
A = [2,3,4,5,6,7,8,9,10,1; 2,-4,-6,-8,-10,-12,-14,-16,-18,-20;
2,3,6,9,12,15,18,21,25,27; 4,8,12,16,20,24,28,32,36,40;
5,10,15,20,25,30,35,40,45,50; 6,12,18,21,24,27,30,33,36,40;
1,1,1,1,1,1,1,1,1,1; 7,14,21,28,35,42,49,56,63,70;
8,10,12,14,16,18,20,22,24,26; 9,12,15,18,21,24,27,30,33,36]; B =
[9,18,21,24,27,30,33,36,40,50];
x = A / B;
Systems of Equations
> A/B
ans =
0.1768
-0.3943
0.5126
0.7961
0.9952
0.8628
0.0302
1.3932
0.5793
0.7783
2 Provide yourself with unique differential equations. Solve each of this differential equation
using matlab built-in functions in Matlab command window.
dy
dz =zy
> syms y(t)
> ode = diff(y,t) == t*y
ode(t) =
diff(y(t), t) == t*y(t)
ySol(t) = C12*exp(t^2/2)
> fplot('ySol')
2
2 x2 d y +3 x dy − y =0
dx2 dx
dsolve(ode)
ySol(x) =
C6/(3*x) + C7*x^(1/2)
> fplot(ySol)
< Insert in here the third order differential equation together with the matlab built-in function you used in
solving it, together with its results. Show also the resulting graph. Delete this message after doing so.>
dy
dt + y=1
y(0)=0.
ySol(t) =
exp(-t) - 1
1 - exp(-t) >>
fplot (ySol)
100
50
-50
-100
-5 -4 -3 -2 -1 0 1 2 3 4 5
cond1 = y(0) == 1;
cond2 = Dy(0) == 0;
ySol(x) = dsolve(ode,conds);
ySol = simplify(ySol)
ySol(x) =
1 - (8*sin(x/2)^4)/3
>> fplot(ySol)
0.5
-0.5
-1
-1.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
uSol(x) = dsolve(ode,conds)
uSol(x) =
120
100
80
60
40
20
-20
-5 -4 -3 -2 -1 0 1 2 3 4
odes(t) =
>>S=
v: [1×1 sym]
u: [1×1 sym]
vSol(t) = S.v
uSol(t) =
C9*cos(4*t)*exp(3*t) + C8*sin(4*t)*exp(3*t)
vSol(t) =
C8*cos(4*t)*exp(3*t) - C9*sin(4*t)*exp(3*t)
cond2 = v(0) == 1;
uSol(t) =
sin(4*t)*exp(3*t)
disp ('MDAS Problem Solver');
4 Before the final examination week, you need to submit your own designed laboratory
exercise. This will serve as your final exam.
< Provide in here a discussion about the laboratory exercise that you will design.
Start with the title. Delete this message after doing so.>