Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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.
10 Equations 10 unknowns
2Q+W+E+R+3T+Y+4U+1I+O+1P=166
Q+W+E+R+2T+Y+3U+I+O+2P=139
Q+W+E+R+1T+2Y+U+2I+O+2P=144
Q+W+E+R+2T+2Y+U+2I+O+3P=159
2Q+W+.5E+R+2T+Y+U+1I+O+3P=143
Q+W+.5E+R+2T+Y+2U+2I+O+3P=137
3Q+W+E+2R+T+Y+U+2I+O+2P=174
Q+W+E+R+T+2Y+U+2I+O+2P=176
Q+W+E+R+T+Y+U+2I+O+2P=144
2Q+W+E+R+T+6Y+U+2I+O+3P=135
A=
A=
2.0000 1.0000 1.0000 1.0000 3.0000 1.0000 4.0000 1.0000 1.0000 1.0000
1.0000 1.0000 1.0000 1.0000 2.0000 1.0000 3.0000 1.0000 1.0000 2.0000
1.0000 1.0000 1.0000 1.0000 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000
1.0000 1.0000 1.0000 1.0000 2.0000 2.0000 1.0000 2.0000 1.0000 3.0000
2.0000 1.0000 0.5000 1.0000 2.0000 1.0000 1.0000 1.0000 1.0000 3.0000
1.0000 1.0000 0.5000 1.0000 2.0000 1.0000 2.0000 2.0000 1.0000 3.0000
3.0000 1.0000 1.0000 2.0000 1.0000 1.0000 1.0000 2.0000 1.0000 2.0000
1.0000 1.0000 1.0000 1.0000 2.0000 2.0000 1.0000 2.0000 2.0000 2.0000
1.0000 1.0000 1.0000 1.0000 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000
2.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 2.0000 1.0000 3.0000
>> B=[166;139;144;159;143;137;174;176;144;138]
166
139
144
159
143
137
174
176
144
138
>> A\B
ans =
12.0000
15.0000
10.0000
25.0000
14.0000
19.0000
2.0000
4.0000
18.0000
10.0000
clc;
disp('10 equations,10 unknowns(Systems of Equations)');
A= input('Enter matrix of coefficients: ');
B= input('Enter matrix of constants: ');
solution = A\B
Results in Command Window
10 equations,10 unknowns(Systems of Equations)
Enter matrix of coefficients: [2 1 1 1 3 1 4 1 1 1;1 1 1 1 2 1 3 1 1 2;1 1 1 1 1 2 1 2 1 2;1 1 1 1 2 2 1 2 1 3;2 1 .5 1 2 1 1 1
1 3;1 1 .5 1 2 1 2 2 1 3;3 1 1 2 1 1 1 2 1 2;1 1 1 1 2 2 1 2 2 2;1 1 1 1 1 2 1 2 1 2;2 1 1 1 1 1 1 2 1 3]
Enter matrix of constants: [166;139;144;159;143;137;174;176;144;138]
solution =
12.0000
15.0000
10.0000
25.0000
14.0000
19.0000
2.0000
4.0000
18.0000
10.0000
2 Provide yourself with unique differential equations. Solve each of this differential equation using matlab built-in
functions in Matlab command window.
A.)
>> eqn= 'Dy=x+(3*y/x)';
>> y=dsolve(eqn,'x')
y=
C12*x^3 - x^2
>> C12=1;
>> x=linspace(0.5,1,10);
>> z=eval(vectorize(y));
>> plot(x,z)
B.)
>> eqn2= 'D2y + 5*Dy + 3*y = cos(x)';
>> inits2 = 'y(0)=1, Dy(0)=2';
>> y=dsolve(eqn2,inits,'x')
Undefined function or variable 'inits'.
y=
(13^(1/2)*exp(x*(13^(1/2)/2 - 5/2))*exp((5*x)/2 - (13^(1/2)*x)/2)*(sin(x) - cos(x)*(13^(1/2)/2 - 5/2)))/(13*((13^(1/2)/2 -
5/2)^2 + 1)) - (8*exp(x*(13^(1/2)/2 - 5/2))*(1704*13^(1/2) + 5759))/(13*(5*13^(1/2) - 21)*(5*13^(1/2) + 21)^2) -
(13^(1/2)*exp(-x*(13^(1/2)/2 + 5/2))*(11*13^(1/2) + 57))/(13*(5*13^(1/2) + 21)) - (13^(1/2)*exp(-x*(13^(1/2)/2 +
5/2))*exp((5*x)/2 + (13^(1/2)*x)/2)*(sin(x) + cos(x)*(13^(1/2)/2 + 5/2)))/(13*((13^(1/2)/2 + 5/2)^2 + 1))
>> z=eval(vectorize(y));
>> plot(x,z)
C.)
>> eqn3= 'D3y + 3*D2y + 2*Dy + 3*y = (x)';
>> inits3= 'y(0)=0,Dy(0)=0,D2y(0)=1';
>> y=dsolve(eqn3,inits3,'x')
y=
>> z=eval(vectorize(y));
>> plot(x,z)
A.1)
>> eqn= 'Dy=(x^2-y)/x';
>> y=dsolve(eqn,'y(1)=2','x')
y=
5/(3*x) + x^2/3
>> x=linspace(0,1,10);
>> z=eval(vectorize(y));
>> plot(x,z)
B.1)
>> eqn2a= 'D2y + 2*Dy + 3*y = sin(x)';
>>
>> inits2= 'y(1)=.5,Dy(2)=.25';
>> y=dsolve(eqn2a,inits2,'x')
y=
>> z=eval(vectorize(y));
>> plot(x,z)
C.1)
>> eqn3a= '2*D3y +D2y + 2*Dy + 3*y = sin(x)';
>> inits3= 'y(2)=.5,Dy(1)=.25,D2y(.5)=.15';
>> y=dsolve(eqn3a,inits3,'x')
y=
>> z=eval(vectorize(y));
>> plot(x,z)
D)
>> [x,y,z]= dsolve('Dx= x+y-z','Dy=-x+z','Dz=2*x-y-z')
x=
z=
>> inits='x(0)=1,y(0)=1,z(0)=1';
>> [x,y,z]= dsolve('Dx= x+y-z','Dy=-x+z','Dz=2*x-y-z',inits);
>> t=linspace(0,0.5,25);
>> xx=eval(vectorize(x));
>> yy=eval(vectorize(y));
>> zz=eval(vectorize(z));
>> plot(t,xx,t,yy,t,zz)
Result
Multiplication
Enter the value of the multiplicand: 36
Enter the value of the multiplier: 35
Multiplicand * Multipler = Product
The product of the two numbers is 1260.00. >>
Division
disp('Division');
disp(' ');
c=input('Enter the value of the dividend: ');
d=input('Enter the value of the divisor: ');
disp(' ');
disp('Dividend / Divisor = Quotient');
q=c/d;
fprintf('The quotient of the two numbers is %0.2f. ',q);
Result
Division
Enter the value of the dividend: 45
Enter the value of the divisor: 9
Dividend / Divisor = Quotient
The quotient of the two numbers is 5.00. >>
Addition
disp('Addition');
disp(' ');
e=input('Enter the value of the first addend: ');
f=input('Enter the value of the second addend: ');
disp(' ');
disp('first addend+ second addend) = Sum');
s=e+f;
fprintf('The sum of the two numbers is %0.2f. ',s);
Addition Result
Enter the value of the first addend: 10
Enter the value of the second addend: 30
first addend+ second addend) = Sum
The sum of the two numbers is 40.00. >>
Subtraction
disp('Subtraction');
disp(' ');
g=input('Enter the value of the minuend: ');
h=input('Enter the value of the subtrahend: ');
disp(' ');
disp('minuend-subtrahend = difference');
s=g-h;
fprintf('The difference of the two numbers is %0.2f. ',s);
Result
Subtraction
minuend-subtrahend = difference
The difference of the two numbers is 27.00. >>
disp('Welcome to MDAS solver! Please choose what course you want to solve');
choose=input('\n 1. Multiplication \n 2. Division \n 3. Addition \n 4. Subtraction \n Choose one from 1 to 4: ');
switch (choose)
case 1
disp('Multiplication')
case 2
disp('Division')
c=input('Enter the value of the dividend: ');
d=input('Enter the value of the divisor: ');
disp('Dividend / Divisor = Quotient');
q=c/d;
fprintf('The quotient of the two numbers is %0.2f. ',q);
response = input ('\n Do you want to continue in solving another problem? If yes press 1, if not press any key: ');
if response == 1
run Bunagan_mdas;
else
disp(' ')
fprintf('Thank you for your time! \n')
end
case 3
disp('Addition')
disp(' ');
e=input('Enter the value of the first addend: ');
f=input('Enter the value of the second addend: ');
disp(' ');
disp('first addend+ second addend= Sum');
s=e+f;
fprintf('The sum of the two numbers is %0.2f. ',s);
response = input ('\n Do you want to continue in solving another problem? If yes press 1, if not press any key: ');
if response == 1
run Bunagan_mdas;
else
disp(' ')
fprintf('Thank you for your time! \n')
end
case 4
disp('Subtraction')
disp(' ');
g=input('Enter the value of the minuend: ');
h=input('Enter the value of the subtrahend: ');
disp(' ');
disp('minuend-subtrahend = difference');
d=g-h;
fprintf('The difference of the two numbers is %0.2f. ',d);
response = input ('\n Do you want to continue in solving another problem? If yes press 1, if not press any key: ');
if response == 1
run Bunagan_mdas;
else
disp(' ')
fprintf('Thank you for your time! \n')
end
end
Result
>> Bunagan_mdas
Welcome to MDAS solver! Please choose what course you want to solve
1. Multiplication
2. Division
3. Addition
4. Subtraction
Choose one from 1 to 4: 1
Multiplication
Enter the value of the multiplicand: 5
Enter the value of the multiplier: 6
Multiplicand * Multipler = Product
The product of the two numbers is 30.00.
Do you want to continue in solving another problem? If yes press 1, if not press any key: 1
Welcome to MDAS solver! Please choose what course you want to solve
1. Multiplication
2. Division
3. Addition
4. Subtraction
Choose one from 1 to 4: 2
Division
Enter the value of the dividend: 45
Enter the value of the divisor: 90
Dividend / Divisor = Quotient
The quotient of the two numbers is 0.50.
Do you want to continue in solving another problem? If yes press 1, if not press any key: 1
Welcome to MDAS solver! Please choose what course you want to solve
1. Multiplication
2. Division
3. Addition
4. Subtraction
Choose one from 1 to 4: 3
Addition
1. Multiplication
2. Division
3. Addition
4. Subtraction
Choose one from 1 to 4: 4
Subtraction
minuend-subtrahend = difference
The difference of the two numbers is 5.00.
Do you want to continue in solving another problem? If yes press 1, if not press any key: 2
4 Before the final examination week, you need to submit your own designed laboratory exercise. This will serve as your
final exam.
The title of my final project will be ,Simple Cooling tank.
Various types of liquid are stored in tanks, and often times it is difficult to handle due to its properties (Highly viscous),
Generally,increasing its temperature will lower its viscosity , resulting in ease of pumping, Therefore temperature in the
tanks sometimes need to be maintained.In some cases low temperatures must maintained in order to avoid
polymerization, or formation of undesired products, or degradation.
In my project, Ill show simple problems regarding cooling tanks and solve it through matlab.