You are on page 1of 2

Assignment 1

MATLAB classes IITGN

August 8, 2018

Question 1
 
1 2 1 4
3 7 5 6
A=
4

3 1 7
3 1 2 1
Write a program to calculate summation of all elements of matrix A.
[Hint: Using sum() function intelligently should do the trick.]

Question 2
 
1 1 3 8 4
3 6 5 5 6
B=
4

3 5 1 7
3 1 2 1 2
Write a program to extract 2nd and 3rd row of of first 3 elements of matrix B and store into a 2 × 3
matrix Bnew .

Question 3
 
1 1 3 8 4
3 6 5 5 6
B=
4

3 5 1 7
3 1 2 1 2
Write a program to update 3rd column of of matrix B with values [ 1 2 3 4 ] instead of [ 3 5 5 2 ].

Question 4
Equation (1) shows the deflection of a simply supported beam (δ) as a function of axial distance (x).
Plot the same in MATLAB.
x2 πx
δ(x) = cos , 0≤x≤1 (1)
100 2
Give proper axes limit and names to the axes.

1
Question 5
Equation (2) shows the electric potential generated by a small dipole of dipole moment p as a function
of radial coordinates r and θ.
1 p cos θ
V = (2)
4π0 r2
Show the equipotential lines as MATLAB plot.
[Hint: Equipotential lines will be obtained by using contour plot. You may want to transform radial
coordinates into cartesian coordinate by relation x = r cos θ, y = r sin θ]

Question 6
Equation (3) shows standard equation of hyperboloid.

x2 y 2 z 2
− − 2 + 2 =0 (3)
a2 b c
Plot upper half of the hyperboloid by choosing appropriate values of parameters a, b, c.

Question 7
Equation (4) shows the temperature distribution in a plate.
2 +y 2 )
T (x, y) = 200 + 300 e−(x (1 − x2 )(1 − y 2 ) − 1 ≤ x, y ≤ 1 (4)

Plot temperature contour and 3D plot in the same figure.


[Hint: Use subplot() command. Use Google for its syntax ]

You might also like