Arola MIDTERMfinal

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Arola, Nur Mohammad I.

Midterm Exam in Computer Application in Chemical


Engineering
Date of Examination: February February 10, 2020

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.
1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3 3 3
4 4 4 4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5 5
6 6 6 6 6 6 6 6 6 6
7 7 7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9 9
9 8 7 6 5 4 3 2 1 1
>> A = [ 1 1 1 1 1 1 1 1 1 1 ; 2 2 2 2 2 2 2 2 2 2; 3 3 3 3 3 3 3 3 3 3; 4 4 4 4 4 4 4 4 4 4; 5 5 5 5 5 5 5 5 5 5; 6 6 6 6 6 6 6
6 6 6; 7 7 7 7 7 7 7 7 7 7; 8 8 8 8 8 8 8 8 8 8; 9 9 9 9 9 9 9 9 9 9; 9 8 7 6 5 4 3 2 1 1]

A=

1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3 3 3
4 4 4 4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5 5
6 6 6 6 6 6 6 6 6 6
7 7 7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9 9
9 8 7 6 5 4 3 2 1 1

>>
>> B = [1;4;9;12;25;36;56;72;81;1]

B=

1
4
9
12
25
36
56
72
81
1

>>
>>Arola_procedure1.m
clc;
disp ('Systems of Equations - 10 equations, 10 unknowns');
eqn1=('1*x1 + 2*x2 + 3*x3 + 4*x4 + 5*x5 + 6*x6 + 7*x7 + 8*x8 + 9*x9 + 10*x10 = 1');
eqn2=('1*x1 + 1*x2 + 1*x3 + 1*x4 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3 3 3 3 3
4 4 4 4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5 5
6 6 6 6 6 6 6 6 6 6
7 7 7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9 9
9 8 7 6 5 4 3 2 1 1

B=

1 4 9 74 5 11 6 2 31 13

x=
0.1045
0.1220
0.1394
0.1568
0.0492
0.0174
0.0348
0.0523
0.0697
0.0871
>>

2 Provide yourself with unique differential equations. Solve each of this differential equation using matlab built-in functions
in Matlab command window.
>> Arola_MidtermExam2a.m

ySol(t) =

exp(-t)/12 + (11*exp(-13*t))/12

Arola_MidtermExam_p2a

syms y(t)
ode = diff(y)+13*y == exp(-t);
ySol(t) = dsolve(ode,cond)

>> Arola_MidtermExam2b.m
ySol(x) =

cos(x) + (x*sin(x))/2

Arola_MidtermExam2b.m

syms y(x)
Dy = diff(y);
ode = diff(y,x,2) == cos(1*x)-y;
ySol(x) = dsolve(ode,);
ySol = simplify(ySol)

>> Arola_MidtermExam2c.m
uSol(x) =

(pi*exp(x))/3 - exp(-x/2)*cos((3^(1/2)*x)/2)*(pi/3 - 1) - (3^(1/2)*exp(-x/2)*sin((3^(1/2)*x)/2)*(pi + 1))/3

Arola_MidtermExam2c.m
u(0)=1, u′(0)=−1, u′′(0)=π.
>> syms u(x)
Du = diff(u,x);
D2u = diff(u,x,2);
>> ode = diff(u,x,3) == u;
cond1 = u(0) == 1;
cond2 = Du(0) == -1;
cond3 = D2u(0) == pi;
conds = [cond1 cond2 cond3];
uSol(x) = dsolve(ode,conds)
uSol(x) = dsolve(ode,conds)

>> Arola_MidtermExam2d.m
ySol(t) =
exp(-t)/4 + (3*exp(-5*t))/4

Arola_MidtermExam2d.m
syms y(t)
ode = diff(y)+5*y == exp(-t);
cond = y(0) == 1;
ySol(t) = dsolve(ode,cond)
fplot (ySol)

>> Arola_MidtermExam2d.m

ySol(x) =

C6*x^(65^(1/2)/20 - 1/4) + C7/x^(65^(1/2)/20 + 1/4)


Arola_MidtermExam2d.m
syms y(x)
ode = 10*x^2*diff(y,x,2)+15*x*diff(y,x)-y == 0;
cond = y(0) == 1;
ySol(x) = dsolve(ode)

>> Arola_MidtermExam2e.m
ySol(x) =
cos(x) + (x*sin(x))/
Arola_MidtermExam2e.m

syms y(x)
Dy = diff(y);
ode = diff(y,x,2) == cos(1*x)-y;
cond1 = y(0) == 1;
cond2 = Dy(0) == 0;
conds = [cond1 cond2];
ySol(x) = dsolve(ode,conds);
ySol = simplify(ySol)
fplot(ySol)

>> Arola_MidtermExam2f.m

uSol(x) =

(pi*exp(x))/3 - exp(-
x/2)*cos((3^(1/2)*x)/2)*(pi/3 - 1) -
(3^(1/2)*exp(-x/2)*sin((3^(1/2)*x)/2)*(pi + 1))/3

Arola_MidtermExam2f.m
syms u(x)
Du = diff(u,x);
D2u = diff(u,x,2);
ode = diff(u,x,3) == u;
cond1 = u(0) == 1;
cond2 = Du(0) == -1;
cond3 = D2u(0) == pi;
conds = [cond1 cond2 cond3];
uSol(x) = dsolve(ode,conds)

>>> Arola_MidtermExam2g.m
uSol(x) =

(pi*exp(x))/3 - exp(-x/2)*cos((3^(1/2)*x)/2)*(pi/3 - 1) -
(3^(1/2)*exp(-x/2)*sin((3^(1/2)*x)/2)*(pi + 1))/3
Arola_MidtermExam2f.m

syms u(x)
Du = diff(u,x);
D2u = diff(u,x,2);
ode = diff(u,x,3) == u;
cond1 = u(0) == 1;
cond2 = Du(0) == -1;cond3 = D2u(0) == pi;
conds = [cond1 cond2 cond3];
uSol(x) = dsolve(ode,conds)
fplot(uSol)

3 Provide yourself with MDAS Problem Solver.


>>Arola_MDAS_SOLVER
clc;
disp ('MDAS SOLVER');
disp ('9*2/3-2');
ans = 9*2/3-2
fprintf('The answer is %0.2f. ', ans);
RESULTS (MATLAB COMMAND WINDOW)
MDAS SOLVER
9*2/3-2
ans =

The answer is 4.00. >>

4 Before the final examination week, you need to submit your own designed laboratory exercise. This will serve as your
final exam.
THERMODYNAMIC CLOSED SYTEM FIRST LAW
The First Law simply says that energy is conserved, meaning that it is neither created nor destroyed. It provides no
definition of energy that is both general and precise. No help comes from its common informal use where the word has
imprecise meanings. However, in scientific and engineering contexts, energy is recognized as appearing in various
forms, useful because each form has mathematical definition as a function of some recognizable and measurable
characteristics of the real world. Thus kinetic energy is defined as a function of velocity, and gravitational potential
energy as a function of elevation.]
By the help of matlab we are going to solve some basic problem that involved non- reacting chemical that focus on
closed system equation

You might also like