Sunteți pe pagina 1din 5

Hi!

As discussed in the class, here are the questions for Assignment # 3:

PART - 1

1. Write the following functions:

a. polar2rect
b. rect2polar

for conversion of polar coordinates to rectangular coordinates and vice-versa. Keep in mind to check
if correct arguments have been provided or not.

2. Write a random number generator which will generate random numbers lying in the
range [0,1) using the following expression:

n_{i+1} = mod(8011*n_{i} + 28417, 135456)

Generate 100000 random numbers and calculate their average and standard deviation. Now generate
100000 random numbers using rand command and evaluate their average and standard deviation.
What is the variation in the results?

Generate two histograms for both the results obtained above using hist command with 10 bins.

3. Plot the function y = e^(-x) * sin(x) for x between 0 and 3, using step size 0.01.Create the following
types of plots:

(a) Stem plot


(b) Stair plot
(c) Bar plot
(d) Compass plot

4. Create a mesh, surface and contour plot of the function z = e^{x + iy} for the interval -1 < x < 1 and
-2pi < y < 2pi. Use 10000 points of x and y in each case. Make three separate plots in each case:
real(z), imaginary(z) and abs(z).

PART - 2: Using the Symbolic Toolbox discussed in the lecture, complete the following tasks:

1.

Where the prime denotes the derivative with respect to t. Determine an expression for the curvature for a deltoid
whose parametric equations are given by

Your result should be in the most simplified form.

2.
The nondimensional response y(t) of a single-degree-of-freedom system whose mass is subjected to a suddenly
applied and maintained force of unit magnitude at t=0 is given by
Obtain a symbolic solution to this integral and then from that result determine the earliest time greater than zero
when y(t) is a maximum.

PART 3: ADVANCED 3D GRAPHICS

1. Create a set of M-Scripts that will carry out the following series of operations:

a. Transforms a point p(x,y,z) to a point P(X,Y,Z) by rotation and translation.


b. Obtains the coordinates of a torus of given parameters a and b and plots the same.

Then using a main M-Script carry out the following task:

1. Plot 4 subplots of a torus


2. First plot: Torus without any rotation
3. Second plot: Torus rotated 60 deg about x-axis
4. Third plot: Torus rotated 60 deg about y-axis
5. Fourth plot: Torus rotated 60 deg about x-axis and y-axis

Your final plot should look like this:

Relevant equations:
Equation of torus:

PART 4: ADVANCED 2D PLOTTING

Create a polar plot of the normalized radiation pattern for: ka = 6*pi, theta ranging from pi/2 and pi/2

Magnify the result obtained using axis command (as discussed in the class) to obtain the following results:
Polar plot of the radiation pattern

Magnified region

PART 5: SLICE PLOT FOR VOLUME VISUALIZATION

Generate a plot which shows slices on planes defined by x = 0, x = 3, y = 5, y = 15, z = 3, and


z = 5, as shown by the last three arguments to the function slice. The color of the plot is mapped to the
values in V on the slices.

Now add contour lines to the slice plot.

Your results should like the following:


Slice plot

Slice plot with contours

S-ar putea să vă placă și