Vous êtes sur la page 1sur 32

MATLAB REPORT

FOR AEROSPACE RELATED APPLICATION

Experiment 1

Plot 2-D and 3-D figures


2-D plots:
Problem 1.1:
Plot a line graph
Aim: Creating a line plot for the given equation:
2∗𝑤
Cl=( ½)∗𝜌∗𝑣2

Theory: Line plot is used to visualize a 2-D parameter. When any aspect varies linearly or is a
curve then line plots are used.

Code:
x= [1 2 3 4 5 6 7 8 9 10];
x= [-100:20:100];
y= 1.72547*10^3./x.^2;
plot(x,y)
grid on
title('cl vs. velocity')
xlabel('velocity')
ylabel('cofficient of lift')
The solution is:
fig: Cl vs. velocity

Conclusion:
As the velocity increases, the coefficient of lift decreases because the drag. The above expression
represents the relation of density, velocity and the weight of an aircraft with the coefficient of lift.
As the velocity increases gradually, there is a rapid change in the coefficient of lift. As the altitude
increases, the density decreases and so the coefficient of lift decreases.

Problem 1.2:
Plot a bar graph:
Aim: To visualize the temperature variation of the nozzle.
Theory: The bar function creates vertical bar charts. The bar function creates horizontal bar charts.
Code:
x = -2.9:0.2:2.9;
y = exp(-x.*x);
bar(x,y)

The solution is:


fig: Temperature vs. nozzle length

Conclusion: The temperature of the nozzle varies along with the length.

Problem 1.3:
Visualise a polar curve
Aim: Plot sine function in polar coordinates.
Theory: Polar curve is used to visualize for 360°.
Code: x=0:pi/100:pi;
y=sin(x);
polar(x,y)
title('sine function in polar coordinates')

fig: Polar sine curve

Conclusion: The plot for the trigonometric functions in polar coordinates can give the relation of
the stagnation pressure points on a cylindrical body for the streamline flow.

Problem 1.4:
Visualizing the gradient of the flow
2 2
Aim: Gradient of the Vector for 𝑥. 𝑒 −𝑥 −𝑦
Theory: The gradient is a multi-variable generalization of the derivative. While a derivative can
be defined on functions of a single variable, for functions of several variables, the gradient takes
its place. Gradients can be used to visualize the flow directions and the flow magnitude.

Code:
[X,Y] = meshgrid(-2:.2:2);
Z = X.*exp(-X.^2 - Y.^2);
[DX,DY] = gradient(Z,.2,.2);
figure
contour(X,Y,Z)
hold on
quiver(X,Y,DX,DY)
hold off
fig: gradient of the flow

Conclusion: The plot for gradient using contour helps to analyze the direction of flow of winds
and storms .

Problem 1.5
Area under the curve
Aim: To find the area under the curve for the equation:
y1=sin(x) and y2= x3-1;
Theory: The area under the curve can give the magnitude for various variables. For example: the
area under the curve for force and displacement gives the magnitude of the work or energy of the
body.
Code:
X=[-1:0.1:1.5];
y1=sin(X);
y2=X.^3-1;
subplot(2,1,1)
plot(X,y1,'bo-',X,y2,'r*-')
subplot(2,1,2)
area(X,y1)

The solution is:

Fig: area under the curve


Conclusion: The area plot helps to determine the parameters like work, energy etc.

3-D Plots:

Problem 1.6:
Surface plot for the given expression
Aim: To find the power required for an aircraft by using the analytical method.
Theory: A 3D plot consists of 3 variables and the series of plots in different planes forms a surface. This
surface shows the nature of relation between the variables.
2∗𝑊 3 ∗𝐶𝑑 2
Power=√ where, W=weight of the aircraft, Cd= coefficient of drag, Cl=coefficient of
𝜌∗𝑆∗𝐶𝑙 3
lift, S=area, 𝜌=density
Code:
cl=0.01:0.05:3;
cd=0.01:0.05:1.5;
[cl,cd]=meshgrid(cl,cd);
pr=sqrt((2.*(73000.^3)*(cd.^2))./(8.9604*10.^-4).*950.*(cl.^3));
figure;
surf(cl,cd,pr)
xlabel('coefficient of lift')
ylabel('coefficient of drag')
zlabel('power required')

The solution is:

fig: surface plot of cl vs. cd and power


required

Conclusion: Power of an aircraft is dependent on the factors like coefficient of lift, coefficient of
drag and wing loading. Greater is the wing loading, greater is the power required. Also, the total
power of an aircraft depends on the thrust available or the design thrust which always remains
constant.

Problem 1.7
3-D surface of a thermal convection equation
Aim: To visualize the3-D surface plot for the thermal convection equation.

Theory: Thermal convection depends on the three parameters: h= convective heat transfer
coefficient, A= area of the body and dt is the change in temperature( surface temperature-
surrounding temperature)
Q= hAdt
Code:
t1=40:20:200;
t2=linspace(15,30);
[t1,t2]=meshgrid(t1,t2);
q=25*100*(t1-t2);
figure;
surf(t1,t2,q)
The solution is:

Fig: temperature difference(x-) vs. area(y-) and


heat (z-)

Conclusion: The thermal convection equation helps to determine the amount of heat generated due to
the flow of liquid or any other fluid. It gives the gradient of the temperature.

Problem 1.8:
Planar 3-D plot
Aim: Motion of planets around an elliptical orbit in a planar 3D.
Theory: Newton showed that the motion of bodies subject to central gravitational force need not
always follow the elliptical orbits specified by the first law of Kepler but can take paths defined
by other, open conic curves; the motion can be in parabolic or hyperbolic orbits, depending on the
total energy of the body. The motion of the planets can be classically analyzed by Kepler’s first
law.
Code:
[l,e]=meshgrid(6400:8000,0:0.1:3)
r= l/ 1-e.^2;
surf(l,r,e)
The solution is:
Fig: planar motion of a planet

Conclusion: The plot for the Kepler’s law provides the detailed information on how the planets
move around an elliptical orbit with the primary body in one of its foci.

Problem 1.9:
Surface plot of trigonometric expression
Aim: To visualize surface plot of trigonometric expression for: z= sinx3+ cosy3
Theory: In mathematics, the trigonometric functions, also called circular functions, angle
functions or goniometric functions are functions of an angle. They relate the angles of a
triangle to the lengths of its sides. Trigonometric functions are important in the study of
triangles and modeling periodic phenomena, among many other applications.
Code:
[x,y]=meshgrid(-1:0.1:1,1:20)
z=sin(x.^3)+cos(y.^3);
surf(x,y,z)

The solution is:

Fig: surface plot of trigonometric function

Conclusion: The motion of the particle can be visualized based on the trigonometric relation.

Problem 1.10
Plot of a flight parameter using mesh grid

Aim: To evaluate the change of drag due to lift with increasing velocity and changing coefficient
of lift.
Theory: In fluid dynamics, the drag coefficient is a dimensionless quantity that is used to
quantify the drag or resistance of an object in a fluid environment, such as air or water. Drag due
to lift, is an aerodynamic drag force that occurs whenever a moving object redirects the airflow
coming at it. It is given by:
Drag due to lift =0.5*ρ*v2*s*k*cl2 ; where,v = freestream velocity, s=area,
k=0.08,cl=coefficient of lift
Code:
cl=0.01:0.05:1.5;
v=linspace(100,1600);
[cl,v]=meshgrid(cl,v);
drag=0.5.*(8.9604.*10.^-4)*950*0.08*(v.^2).*(cl.^2);
figure;
surf(cl,v,drag)
The solution is:

Fig: Cl vs. velocity and drag due to lift

Conclusion: : The drag due to lift generated decreases as the velocity of the plane increases. The
intersection of the drag due to lift and the zero lift curve gives the point where the zero lift drag and
the drag due to lift is equal.

Experiment 2

Finding the eigenvalues and eigenvectors


Theory
Eigen vector is the non-zero vector that changes only by a scalar factor when the linear
transformation is applied to it. They are associated with the linear system of equations. The
characteristic equation is given by:
│A-ℷ│X=0
Where, A is any given square matrix
ℷ is the eigen value of the given matrix
X is the eigen vector
Each eigen vector is paired with the corresponding eigen value.
Only when X≠ 0; the solution is possible as:
│A-ℷ│I=0 ;Where I is the identity matrix.
The use of eigen vector and eigen value is found in stability analysis, oscillation of vibrating
systems and understanding the physics of rotating body.

Problem 2.1
For 2-D stress transformation
Aim: To find the minimum and maximum principal stresses
Theory: For a simply supported beam carrying concentrated load at the mid-span, maximum
principal stress can be determined using matrix method. The values of the coefficient that is
obtained gives the principal stress values.

Fig: stress on a body

σ𝑥 τ𝑥𝑦 +50 40
For [𝜎]= [τ σ𝑦 ]=[+40 −10]
𝑥𝑦

The principal stresses are: σ𝑚𝑖𝑛 = 30𝑀𝑝𝑎 and σ𝑚𝑎𝑥 = 70 𝑀𝑝𝑎

Code:
s=[50 40; 40 -10]; % s is the matrix
y=eig(s)
The solution is: -30.0000 70.0000
Conclusion: Stress analysis helps to determine the maximum and the minimum stresses as well as
the distribution of the loads.

Problem 2.2
3-D stress strain transformation
Aim: For 3-D stress strain transformation eigenvalues can be found out.
Theory: When the stresses are acting in a 3-D body, the analytical method to find the stresses is
difficult. Matrix method can be applied to find out the principal stresses as eigenvalues, also
eigenvectors can be found.
Fig: stress on a 3-D body

σ𝑥 τ𝑦𝑥 τ𝑧𝑥 3500 −1050/2 0


σ𝑖𝑗 = [τ𝑥𝑦 σ𝑦 τ𝑧𝑦 ] = [−1050/2 700 400]
τ𝑥𝑧 τ𝑦𝑧 σ𝑧 3000 500 100
Code:
s=[3500 525 10;-525 70 400;100 500 0]; % s is the matrix
eig(s)
The solution is:
3.4181
-0.3771
0.5289
Conclusion: Stress analysis helps to determine the maximum and the minimum stresses as well as
the distribution of the loads.

Problem 2.3:
Eigenvector for the 2-D stress transformation
Aim: To find the eigenvector for the 2-D stress transformation
Theory: Eigenvectors are also used in order to analyse the stress of a body. Along with
eigenvalues, eigenvectors provides information about which direction the stress acts.
−56 11.2 0
[ 11.2 −14 0] = σ
0 0 0
Code:
s=[-56 11.2 0;11.2 -14 0;0 0 0]; % s is the matrix
[V,D]=eig(s)
The solution is: V =
-0.9701 -0.2425 0
0.2425 -0.9701 0 (V= Eigenvector)
0 0 1.0000

D=
-58.8000 0 0
0 -11.2 0 (D=Eigenvalue)
Conclusion: Stress analysis helps to determine the maximum and the minimum stresses as well
as the distribution of the loads.

Problem 2.4
Eigenvectors and eigenvalues for huge loads
Aim: To find the vibration in the structure of rockets
Theory: Mass and Stiffness matrix:
To find the vibration in the structure of rockets (four parts), the mass is assumed to be at the
bottom. The wall constitutes the spring which can be assumed as the 1-D system for each portion.

Fig: stresses on a vertical body

For the body with values as: (in matrix)


M=[m1 0 0 0;0 m2 0 0;0 0 0 m3;0 0 0 m4]
K=[2k1 -2k1 0 0;-2k1 2k1+2k2 -2k2 0; 0 -2k2 2k2+2k3 -2k3;0 0 -2k3 2k3+2k4]
Code:% For m1=1500, m2=3000,m3=3000,m4=1500
%k1=400,k2=800,k3=1200,k4=1600
M=[1500 0 0 0;0 3000 0 0;0 0 0 3000;0 0 0 1500];K=[2*400 -2*400 0 0;-2*400
2*400+2*800 -2*400 0; 0 -2*800 2*800+2*1200 -2*1200;0 0 -2*1200
2*1200+2*1600];[V,D]=eig(K,M)
The solution is:
V=
1.0000 -1.0000 0.2916 -0.0000
0.6158 0.6294 -0.5129 -0.0000
0.3742 0.8371 1.0000 -1.0000
0.1697 0.4676 0.7074 -0.0000
D = 0.2049 0 0 0
0 0.8690 0 0
0 0 1.4715 0
0 0 0 Inf
Conclusion: The vibration that gets generated in the various bodies can also be determined
using eigenvectors and eigenvalues for huge loads and their effects can be visualized.

Experiment 3
Polynomial evaluation and curve fitting
Theory:
To evaluate a polynomial: When evaluating a polynomial, a variable is assigned the desired
value. Finding the roots of a quadratic equation, value of the given function or the polynomial for
a given value is done for evaluating the polynomial. The evaluation of the polynomial have a
wide range of applications in engineering and mathematics.
MATLAB has a collection of very useful functions for working with the polynomials. The
polynomial can be evaluated for a range of the values.
Fitting a Curve:
Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit
to a series of data points, possibly subject to constraints. It helps in providing the best fit for the
model.Fitting a curve for the given set of data help in realizing the relation and the characteristics
of the data. It also helps in understanding the type of data.There are a number of ways to fit a
curve in the data.

Problem 3.1:
Evaluating the polynomial for bending moment for a triangular variably distributed load
Aim: To find out the coefficient for the bending moment of variably distributed load.
Theory: The bending moment for a beam of length l on which a load of w acts at a distance of x.
M(x) is given by:
−𝑤 3 2𝑤 𝑤𝑙
𝑥 + (𝑥 − 0.5𝑙)3 + 𝑥
3𝑙 3𝑙 4
Code:
x=[1:1:6]
w=8;
l=6;
a=(-w/(3*l));
b=(2*w)/(3*l);
c=l/2;
d=(w*l)/4;
m=a*(x.^3)+b*(x-c).^3+d*x
The solution is:
x=1 2 3 4 5 6
m = 4.4444 19.5556 24.0000 20.4444 11.5556 0
Conclusion: The coefficients for the bending moment equations can be determined for the
approximate values.

Problem 3.2:
The maximum deflection occurring in the beam
Aim: To find out the maximum deflection occurring in the beam of length l due to the applied
load w at a distance x.
Theory: The maximum deflection occurring in the beam of length l due to the applied load w at a
distance x, with the following parameters

E= Young’s modulus of elasticity


I= moment of inertia
Y= deflection
The deflection is given by:
1 −𝑤𝑥 5 𝑤 𝑤𝑙 5
( + (𝑥 − 𝑜. 5𝑙)5 + 𝑥3 − 𝑤𝑙 3 𝑥)
𝐸𝐼 60𝑙 30𝑙 24 192
Code:
x=4.8
E=200;
height=75;
width=25;
inertia=((height.^3)*width)/12
w=8;l=6;
a=(-w/(3*l));
b=(2*w)/(3*l);
c=l/2;
d=(w*l)/4;
e=(-w/(60*l));
f=(w/(30*l));
g=(w*l)/24;
h=(5*(l.^3)*w)/192;
def1=e*(x.^5)+f*(x-c).^5+g*(x.^3)-h*x;
deflect=def1/(E*inertia)
The solution is : x= -4.58
Conclusion: It implicates that the bending occurs as hogging and finding out the moment or the
bending moment of the beam can help analyse the safe limit for the loading conditions.

Problem 3.2:
Polyvalm

Aim: Using polyvalm for a set of data to a desired a polynomial of desired degree.

Theory: Using polyvalm can help to determine the roots of the various higher order equations in
an easy way.

Code:
p = [1 7 0 -5 9];
X = [1 2 -3 4; 2 -5 6 3; 3 1 0 2; 5 -7 3 8];
polyvalm(p, X)
the solution is:
ans =
2307 -1769 -939 4499
2314 -2376 -249 4695
2256 -1892 -549 4310
4570 -4532 -1062 9269
Conclusion: It provides the values or the various roots of the higher degrees of equation.

Problem 3.3:
Fitting a curve
Aim: Fitting a curve for the given set of data:

Theory: Fitting a curve on the obtained approximate values coefficient values can provide the
information about the accuracy of the polynomial and its order. If the curve fits properly then the
coefficients are correct for the given polynomial.
For x = [1 2 3 4 5 6];
y = [5.5 43.1 128 290.7 498.4 978.67];
Code:
x = [1 2 3 4 5 6]; y = [5.5 43.1 128 290.7 498.4 978.67];
p = polyfit(x,y,4)
x2 = 1:.1:6;
y2 = polyval(p,x2);
plot(x,y,'o',x2,y2)
grid on
The solution is:
p = 4.1056 -47.9607 222.2598 -362.7453 191.1250
The solution is:

Fig: x vs. y

Conclusion: Fitting the given set of data to a desired a polynomial of desired degree helps to
realize the characteristics of the data.

Problem 3.4
Fit a curve
Aim: To fit a curve for the given function: y=sin(x)
Theory: Trigonometric functions have a definite form of curves. Using fitting of curve we can
analyze the accuracy of these curves used for various polynomials.
Code:
x=1:10;
y=sin(x);
[P,S] = polyfit(x,y,5);
yfit= polyval(P,x);
plot(x,y,x,yfit)
The solution is:
Fig: curve fitting of sine function

Conclusion: Polynomials is evaluated and the curves for sine function is fitted.

Experiment 4

Solving the algebraic and transcendental equation


Theory:
An algebraic equation or polynomial equation is an equation of the form, where P and Q are
polynomials with coefficients in some field, often the field of the rational numbers. The letter that
is used to represent an unknown quantity a variable. The '3' in 3x + 2 = 17 is called the
coefficient, while the '2' and '17' are called constants. means manipulating the equation so that the
variable is by itself on one side of the equation and everything else is on the other side of the
equation.
Transcendental equations are equations containing transcendental functions, i.e. functions which
are not algebraic. These equations have an infinite number of roots. For example:
b.xcosx - sinx= 0 is a transcendental equation because it has an infinite number of roots.
i.e x=(0,+4.493,-4.493,+7.739,-7.739….)
So, solutions to these equations are always obtained iteratively.

Problem 4.1:
Solution for a simple quadratic equation:
Aim: To find the solution for a simple quadratic equation:
X2-7x+12=0
Theory: Quadratic equation is an algebraic equation with degree two. It has two roots as it has
two variables.
Code:
eq = 'x^2 -78*x + 28= 0';
s = solve(eq);
disp('The first root is: '), disp(s(1));
disp('The second root is: '), disp(s(2));
The solution is:
The first root is:
4 - 3^(1/2)*2i
The second root is: 4 + 3^(1/2)*2i
Conclusion: The roots of an equation can be found.

Problem 4.2:
Roots for higher degree of polynomials
Aim: To find the roots for higher degree of polynomials.
Theory: A polynomial function of degree n in the variable x is a function of the form
P(x) = an xn + an−1 xn−1 + …….+ a1 x + a0, where each ai is a real number, an ≠ 0, and n is a whole number.
Higher degree polynomials can be considered as the polynomials which have a degree higher than 2.
For: x4 − 7x3 + 3x2 − 5x + 9 = 0.

Code:
v = [1, -7, 3, -5, 9];
s = roots(v);
disp('Numeric value of first root'), disp(double(s(1)));
disp('Numeric value of second root'), disp(double(s(2)));
disp('Numeric value of third root'), disp(double(s(3)));
disp('Numeric value of fourth root'), disp(double(s(4)));
The solution is:
Numeric value of first root
6.6304
Numeric value of second root
1.0598
Numeric value of third root
-0.3451 + 1.0778i
Numeric value of fourth root :
-0.3451 - 1.0778i
Conclusion: The roots of a higher degree polynomial can be determined.

Problem 4.3:
Solve a transcendental equation
Aim: To solve a transcendental equation:

(sinx)2 . e−x/2 − 0.1 = 0

Theory: Transcendental functions are functions that cannot be written as polynomials, and so their
solutions can be more complicated than solutions of polynomials.
For instance, log(x), exp(x), sin(x), etc., are all transcendental functions, because they are not the
solutions of any polynomial equations.
Code:
x=[0:2:10];
y=sin(x).^2.*exp(-x/2) - 0.1;
y0=zeros(1,length(x));
plot(x,y,x,y0)
The solution is:
y = -0.1000 0.2042 -0.0225 -0.0961 -0.0821 -0.0980

Conclusion: Transcendental function is visualized whose roots are found to be irrational.

Problem 4.4
Solve the transcendental equation
Aim: To solve the following equation:

𝑥 2 + sin(𝑥) − 1 = 0
Theory:
The solution to the algebraic equation of various degrees are determined and also solution to the
transcendental equation.
Code:
fsolve(@(x) x^2+sin(x)-1, 1.0)
the solution is: 0.6367
Conclusion: The solution to the transcendental equations can be found with higher accuracy.

Experiment 5

Solving systems of linear equations


Theory:A general system of m linear equations in n unknowns AX=B where A=m*n, X=n*1 and
B=m*1;
In MATLAB, solutions to the matrix is computed with the matrix division operations.
X=A/B
For X*A=B; then by using the Gaussian elimination it is solved as :
X=B/A;
The matrix A and B are known and the only unknown is X.
There are two types of matrices:
a) Under-determined matrix:
In these types of matrixes, there is more number of variables than the equations.
The solution is never unique. MATLAB finds the basic solution which has at most m non-
zero components. QR factorization with column pivoting is used by the MATLAB.
b) Over-determined matrix: These types of equations have more equations than the
variables. For example: doing least squares fit means minimizing the sum of the squares of
the deviations of the data from the model.

Problem 5.1:
Find out the values of x for the equations.
Aim: To find out the values of x for the equations.
Theory: A system of equations can be represented by an augmented matrix. In an augmented
matrix, each row represents one equation in the system and each column represents a variable or
the constant terms.

3 4 1
For: A=|−2 0 3|, B=[2 1 0]
1 2 4
Code:
A=[3 4 1;-2 0 3;1 2 4];
B=[2 1 0];
x=A/B
The solution is:
x = 2.0000
-0.8000
0.8000
Conclusion: Augmented matrices are a shorthand way of writing systems of equations. The
organization of the numbers into the matrix makes it unnecessary to write various symbols
like x, y.

Problem 5.2
Solving the node problem
Aim: To find the solution for equation generally used in the loop current analysis.

Theory: Using system of linear equations for matrices can provide the values for the voltage and
current along the given route of the wire.
Fig: Current loop analysis

For: X1+2X2-X3+x4=3
2X1+X3-2X4=0
-X1+2X2-2X3+3X4=5
Code:
A=[1 2 -1 1;2 0 1 -2;-1 2 -2 3];
B=[3;0;5];
x=A\B
The solution is:
0
1.6667
0
0.3333
Conclusion: The current across the various routes and resistors can be determined.

Problem 5.3
Reaction forces acting on a beam
Aim: To find the reaction forces acting on a beam.
Theory: The beam is assumed to be weightless .The reaction forces are calculated where there are
roller and hinged supports, the weights acting on the beam creates an appreciable amount of
deflection. The moments on each after the calculation of reactions can be determined:
Each moment is represented as: X1,X2,X3,X4.
X1+X4=1000
X1+X2= 1100
X2+X3=700
X3+X4=600
Code:
A=[1 0 0 4;1 1 0 0;0 1 1 0;0 0 1 1];
B=[1000;1100;700;600];
x=linsolve(A,B)
The solution is:
x = 1000
100
600
0
Conclusion: The reaction forces on each beam can be determined from the equations based on the
equations of moments.

Experiment 6
Numerically evaluating single/double/triple integrals
Theory: The function f(x) to be integrated is called the integrand. The symbol dx is separated
from the integrand by a space. If a function has an integral, it is said to be integrable. The points a
and b are called the limits of the integral. An integral where the limits are specified is called a
definite integral.

Problem 6.1
Single Integral
2
Aim: To evaluate the equation: ∫−2 3𝑋 + 2 𝑑𝑋
Theory: In a single integral, the integrand is defined and finite on a closed and bounded interval,
bracketed by the limits of integration.
Code:
fun=@(x)3*x+2
integral(fun,-2,2)
The solution is:
function_handle with value:
@(x)3*x+2
ans =
8
Conclusion: The displacement of the body defined by the above expression is determined.

Problem 6.2
Double integral
Aim: To solve the double integral given as:
2
∬ 𝑋 + 𝑌 3 𝑑𝑋𝑑𝑌
0

Theory:
The double integral of function f(x,y) is denoted by
∬f(x,y)dA,
R
where R is the region of integration in the xy-plane.
Code:
fun=@(x,y) x+y.^3
q=integral2(fun,0,1,0,2)
The solution is:
function_handle with value:
@(x,y)x+y.^3
q=
5.0000
Conclusion: It provides information about the surface enclosed within the contour.

Problem 6.3
Triple integral
Aim: To evaluate the triple integral given by:
4
∭0 3𝑥 2 + 4𝑦 2 −3z dxdydz
Theory:
Let f(x,y,z) be a continuous function of three variables defined over a solid Q. Then the triple integral
over Q is defined as

where the sum is taken over the rectangular solids included in the solid Q and lim is taken to mean the limit
as the side lengths of the rectangular solid.

Code:
fun=@(x,y,z)(3*x.^2+4*y.^2-3*z)
q=integral3(fun,0,1,-1,1,2,4)
The solution is:
function_handle with value:
@(x,y,z)(3*x.^2+4*y.^2-3*z)
q=
-26.6667
Conclusion: It is used to find out the volume enclosed.

Experiment 7
Integration of numeric data
Theory: Numerical integration is the approximate computation of an integral using numerical
techniques. The numerical computation of an integral is sometimes called quadrature. In
numerical analysis, numerical integration constitutes a broad family of algorithms for calculating
the numerical value of a definite integral, and by extension, the term is also sometimes used to
describe the numerical solution of differential equations.

Problem 7.1
Varying velocities at various probe location
Aim: To find out the free jet velocity at various probe location.
Theory: The free jet is the jet that does not have any physical obstacle on its way. While coming
out of a nozzle it varies with the distance.
For the location being radial: x=(0,5,10,15,20) mm
And the velocity is determined as:
48.67 48.05 46.93 40.12 17.42;
48.67 47.73 43.57 35.07 20.25
47.73 41.79 30.18 20.25 12.92
43.22 37.38 31.42 25.55 18.28
Code:
Y=[0 5 10 15 20];
V=[48.67 48.05 46.93 40.12 17.42;
48.67 47.73 43.57 35.07 20.25;
47.73 41.79 30.18 20.25 12.92;
43.22 37.38 31.42 25.55 18.28];
Q1=trapz(Y,V,2)
figure
plot(Y,V,'-*')
xlabel('radial distance')
ylabel('velocity')
title('Decaying velocity of free jet')
The solution is:
numint1
Q1 = 840.7250 804.1500 612.7250 625.5000

Conclusion: The area under the individual curve gives the energy.

Problem 7.2:
Changing behavior of the temperature with respect to time in forced convection
Aim: To evaluate the temperature wrt time in forced convection.
Theory: Forced convection is a mechanism, or type of transport in which fluid motion is
generated by an external source (like a pump, fan, suction device, etc.). It should be considered as
one of the main methods of useful heat transfer as significant amounts of heat energy can be
transported very efficiently.
For the time being (15.1,15.2,15.3,15.4,15.5)s
The temperature in the condenser is found to be:
89.96 90.55 91.73 90.54 91.86
94.24 94.66 93.96 92.45 91.74
91.63 92.16 91.63 92.43 92.12
Code: Time=[15.1 15.2 15.3 15.4 15.5];
Temp=[89.96 90.55 91.73 90.54 91.86;
94.24 94.66 93.96 92.45 91.74;
91.63 92.16 91.63 92.43 92.12];
cumtrapz(Time,Temp,2)
figure
plot(Time,Temp,'-*')
title('time vs. temperature in forced convection experiment')
xlabel('time')
ylabel('temperature')
grid on
The solution is :
ans =
0 9.0255 18.1395 27.2530 36.3730
0 9.4450 18.8760 28.1965 37.4060
0 9.1895 18.3790 27.5820 36.8095

Conclusion: It helps to find out temperature after which there will be no heat transfer in the body
(remains constant).

Experiment 8
Solving Ordinary (Linear) Differential Equations
Theory:
Linear ordinary Differential equation has one or more functions of independent variable and its
derivatives. The solution of an ODE satisfy the existence and uniqueness property. It is represented
as:
F(x,y,y’,……y(n))=0;
y=f(x)
y=dy/dx
y(n)=d(n)y/dx(n)
In MATLAB, Runge-Kutta method is used to analyze these types of equations.

Problem 8.1:
Solve the ordinary differential equation using ode45
Aim: To find the velocity field for the flow.
Theory: ode45 solves the initial value problem numerically and then is used to plot the numerical
solutions. It can solve only the non-stiff type of problem with medium accuracy.
For u=3*y2 and v=2*x
Code:
function acceleration(yo)
[x,y]=ode45(@fun,[0,5],yo);
plot(x,y);
grid on
title('velocity field')
function dydx=fun(x,y)
% for velocity along x-axis(u)=3y.^2
%for velocity along y-axis(v)=2*x
dydx=2*x/(3*y.^2);

Fig: unsteady flow velocity

Conclusion: The flow is unsteady because the velocity changes linearly with time.

Problem 8.2:
Slope of the equipotential line
Aim: To find the slope of the equipotential line
For u=6xy2 +2 and v=3xy+7

Theory: Equipotential lines are like contour lines on a map which trace lines of equal altitude. It is
the line along which the potential head at all points is equal.
The slope is dy/dx=-u/v
Code:
function equi(y0)
[x,y]=ode23s(@slope,[0,10],y0);
plot(x,y);
grid on;
title('slope of the equipotential line')
function dydx=slope(x,y)
dydx= (-6*x*y.^2+2)/(3*x*y+7);
The result is:

Conclusion: Equipotential lines help to visualize the type of flow relating the streamline because
streamline and equiopotential lines are perpendicular to each other.

Problem 8.3
Tuned mass damper

Aim: To find out the damping (vibration) using tuned mass damper

Theory: The multistage rockets (ARES-I) are taller in length so when they are ejected then the
upper parts experience the vibrations which can eventually cause the rocket to collapse. In order to
control these vibration or to damp them a mass is provided in the pendulum which absorbs the K.E
from the vibration and transfers to the mass of the pendulum decreasing the damping time and
increasing the safety.

Code:
function leftout(y0)
[x,y]=ode45(@find,[0,10],y0)
plot(x,y)
grid on
function dydx=find(x,y)
dydx= 0.3240*exp(-5.54.*x) -3.3240*exp(-0.54.*y)+3
Conclusion: It helps to visualize the magnitude of the vibration and to get the information on how
fast it can get damped.
Experiment 9
Solving ordinary non-linear differential equations
Theory: A non-linear differential equation is simply a differential equation where some non
linearity is applied to either the inputs or the outputs of the equation.
Non-linear differential equations are formed by the products of the unknown function and its
derivative is allowed and its degree is > 1. Nonlinear differential equations can exhibit very
complicated behavior over extended time intervals, characteristic of chaos. If the differential
equation is a correctly formulated representation of a meaningful physical process, then one
expects it to have a solution.

Problem 9.1:
Angular velocity of a pendulum
Aim: To find the angular velocity of a pendulum.
d 2 θ /dt2 + ω 2sinθ = 0 where the initial conditions are given as f(0)=1

Theory:
The motion of the pendulum at various intervals of time can be analyzed. This concept is useful
where simple harmonic motion is observed.

Code:
function avenue=suggest(t,z)
wsq=1.56;
avenue=[z(2);-wsq*sin(z(1))]
and another calling file as:
tspan=[0 20];
z0=[1;0];
[t,z]=ode23('suggest',tspan,z0);
x=z(:,1);
y=z(:,2);
figure
plot(t,x,t,y)
grid on
xlabel('t')
ylabel('x and y')
The solution is:

Conclusion: The angular velocity of the pendulum varies in two dimensions.


Problem 9.2:
Vander Pol’s equation (second order)
Aim: To visualize the Vander Pol’s equation of second order
Theory: Vander Pol’s Equation is used to visualize the oscillatory motion that are widely used in
the radio receiver and remote motion controllers.

Code:
function dydt = solvefor(t,y)
dydt = [y(2); (1-y(1)^2)*y(2)-y(1)];
and another calling file
[t,y] = ode45(@solvefor,[0 20],[2; 0]);
plot(t,y(:,1),'-',t,y(:,2),'--')
title('Solution of van der Pol Equation, \mu = 1');
xlabel('time t');
ylabel('solution y');
legend('y_1','y_2')

Conclusion: It helps to visualize the oscillatory motion that are widely used in the radio receiver
and remote motion controllers.
Experiment 10
Solving parabolic partial differential equation
Problem 10.1
The heat equation
Aim: To solve the heat equation in the form of parabolic pde

Theory: The heat equation is a parabolic partial differential equation that describes the distribution
of heat (or variation in temperature) in a given region over time. It is used to calculate temperature
with respect to time. The one-dimensional form is given by: Fourier’s law of heat transfer which is
the rate of heat transfer proportional to negative of the temperature gradient,

Rate of heat transfer ∂u


= −K 0
area ∂x
The 2-D heat equation is :
ut = c 2∇2u = c 2 (uxx + uyy ) for 0 < x < a, 0 < y < b

Code:
function [c,f,s] = pdex1pde(x,t,u,DuDx)
c = 2pi;
f = DuDx;
s = 0;

function u0 = pdex1ic(x)
u0 = tan(2*x);

function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)


pl = ul;
ql = 0;
pr = pi.^2 * exp(t);
qr = 1;
x = linspace(0,1,10);
t = linspace(0,2,10);
m = 0;
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
u = sol(:,:,1);
figure(1)
surf(x,t,u)
title('Numerical solution computed with 10 mesh points')
xlabel('Distance x')
ylabel('Time t')
figure(2)
plot(x,u(end,:))
title('Solution at t = 1.5')
xlabel('Distance x')
ylabel('u(x,2)')

The solution is:


pdex1pde(2,2,3,1)
ans =
6.2832
Conclusion: The location at which the heat will be maximum can be determined. Also the
temperature gradient on the body can be visualized.

Problem 10.2
Diffusion equation
Aim: To solve the diffusion equation in the form of parabolic pde

Theory: The diffusion equation is a partial differential equation. In physics, it describes


the behavior of the collective motion of micro-particles in a material resulting from the
random movement of each micro-particle. In mathematics, it is applicable in common to a
subject relevant to the Markov process as well as in various other fields, such as the
materials sciences, information science, life science, social science, and so on. These
subjects described by the diffusion equation are generally called Brown problems.

The 2-d diffusion equation is given by:

∂u ∂2 𝑢 ∂2 𝑢
= D( + )
∂t ∂x2 ∂y2

Code:
function [c,f,s] = pdex4pde(x,t,u,DuDx)
c = [1; 1];
f = [0.024; 0.17] .* DuDx;
y = u(1) - u(2);
F = exp(5.73*y)-exp(-11.47*y);
s = [-F; F];
function u0 = pdex4ic(x);
u0 = [1; 0];

function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t)


pl = [0; ul(2)];
ql = [1; 0];
pr = [ur(1)-1; 0];
qr = [0; 1];
x = [0 0.005 0.01 0.05 0.1 0.2 0.5 0.7 0.9 0.95 0.99 0.995 1];
t = [0 0.005 0.01 0.05 0.1 0.5 1 1.5 2];
m = 0;
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure(1)
surf(x,t,u1)
title('u1(x,t)')
xlabel('Distance x')
ylabel('Time t')
figure(2)
surf(x,t,u2)
title('u2(x,t)')
xlabel('Distance x')
ylabel('Time t')

The solution is:

Conclusion: It gives the information about the concentration gradient

Vous aimerez peut-être aussi