Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask MATLAB Expert

Assignment

PART A: Functions of Two Parameters

QUESTION 1

Create a function to solve a generic 3 x 3 system of equations with a column vector representing 3 different constants.

a) Find the determinant of A to establish if the input coefficient matrix is invertible. If the determinant is zero then the matrix is not invertible.

b) Use an IF statement based on the result of a) to decide whether or not to proceed with a solution based on ONE of four methods.

c) Using the AX = E equation and ONE of four of the following methods, solve the 3 x 3 system:

i. using Gauss-Jordan reduction procedure (use RREF)

ii. using A-1B % find A-1, the inverse matrix, using INV or A^-1

iii. using A \ B % left hand Gaussian Elimination division

iv. using [B'/A']' % right hand division

d) Create code in your function to return a 3 x 1 vector called X. [4 Marks]

QUESTION 2

Solve the following problem with the function created in question one:

927_Matrix.jpg

a) using your function from a) find the solution (matrix X which is a 3 x 1 matrix).

b) Run your function at command-line level and check the solution matrix, X, with AX = E.

c) Evaluation of Solution:

Please use an inequality (a Boolean expression) to evaluate the accuracy of your solution.

Explanation of the NORM and EPS Functions

When passed a difference vector (A*X - E), NORM gives the 2-norm or Euclidean Distance (or length) from the origin to the difference vector.

>> M = [1 2 3];

>> norm(M,2)
ans = 3.7417
>> norm(M)
ans = 3.7417

EPS (Epsilon), a MATLAB built-in function, with no arguments, is the distance from 1.0 to the next larger double precision number, that is EPS with no arguments returns 2^(-52).

>> eps
ans = 2.2204e-16

PART B: Graphing in MATLAB

Complete the MATLAB code wherever required for the following 2D MATLAB graph functions:

QUESTION 1

STEM graph displaying the function f(t) = et/4 sin t f or the interval 0 ≤ t ≤ 2π

t = linspace(0,2*pi,150);
exponent = ...;
a=exp(exponent*...).*(sin(t));
stem(...,...)
syms t
f = exp(exponent*...).*(sin(t));
grid on

xlabel '...'
ylabel('...');

title_handle = title(['Stem Plot of ' ' '$' latex (f) '$'],...

'interpreter','latex'); set(...,'fontsize',16)

QUESTION 2

COMPASS graph displaying the function

z = cos θ + j sin θ for the interval -π ≤ θ ≤ π

theta=-pi:pi/...:pi
rx=cos(...)
ry=sin(...)
z= ... + ...
compass(...)

QUESTION 3

a) FILL graph displaying the function r2 = 10cos 5t f or the interval 0 ≤ t ≤ 2π

HINT: make r the subject and use the trigonometric identities to find x and y:
x = r cos t, y = r sin t

t = linspace(0,2*pi,...);
r=sqrt(...(...));
x=...
y=...
fill(x,y,'c')
axis('square')

b) Try altering the function, r2, to increase the number of "petals" from 10 to 20. Save the MATLAB figure as a PNG file.

QUESTION 4

SEMILOGX graph displaying the function x = e-t, y = t, f or the interval 0 ≤ t ≤ 2π

HINT: fill out the ellipses with some MATLAB Code.

t = linspace(0,2*pi,200);
x = exp(-t);
y1 = ...;
semilogx(...,...), grid on

QUESTION 5

LOGLOG graph displaying the function x = et, y = 100 + e2*t f or the interval 0 ≤ t ≤ 2π

t = linspace(0,2*pi,200);
x = exp(t);
y = 100+exp(...);
loglog(...,...), grid

Complete the MATLAB code wherever required for the following special MATLAB graph functions:

QUESTION 6

EZPLOT graph for the following functions:

x = cos (3t),
y = tsin (3t),
z = √3t

a) ezplot3('...','...','...')

Increase the number of loops from 3 to 6:

b) ezplot3('...','...','...')

QUESTION 7

FPLOT graph to display the following function

y = 4x2 + 8sin (3x) f or the interval -7 to 7

fplot('...',[...,...])
xlabel x
ylabel ...
title '...'

PART C: Flight Path of a Model Rocket

Scenario

The flight path of a model rocket, of mass 0.05 kilograms, can be modelled in MATLAB using simple equations and graphs. During the first 0.25 seconds (s) the rocket is propelled upward by the rocket engine with a force of 25 N. However, the rocket runs out of fuel before reaching its peak hence, the engine stops.

The rocket then flies up carried by its own momentum while slowing down under the gravity force (g = 9.81metres/s/s) at a constant deceleration.

Once it reaches the peak of its flight path the rocket starts to fall down. At a downward velocity of 20 m/s the parachute opens instantly so the velocity stays constant (that is 20 m/s) with an acceleration of zero until it hits the ground.

The rocket is assumed to be a particle that moves along a straight line in the vertical plane. For motion with constant acceleration (a) along a straight line, the velocity and position as a function of time (t) are given by the equations:

1. v(t) = v0 +at

2. h(t) = s0 + v0t + ½at2

where v0 and s0 are the initial valocity and position (hight) respectively

MATLAB Task

Write a MATLAB script to calculate the height (metres) and the speed (metres/s) of the rocket over flight-time.

Plot these results against time using two graphs.

NOTE: the speed metric should include the direction (+up / -down) as well as metres/s information.

Instructions to create this MATLAB script:

o Flight path of the rocket is divided into three segments (see below for detailed description)

o Each segment is calculated with either WHILE or FOR-END loops

o In every iteration, of a loop, time is incremented by Dt = 0.01

o Separately graph the results of height (m) and velocity (m/s)

o Annotate your plots inside your script or with the Plot Editor

o The accuracy of the h(t) and v(t) results depends on the size of the time increment, Dt

o Set n to be no bigger than 50,000 to avoid infinite loops

o Make use of the MATLAB Code frame on page 15 to complete the script

Detailed Description of the Three Segments of the Rocket's Flight-time

a) Segment One

The first 25 seconds when the rocket engine is firing and the rocket is moving upward with constant acceleration. Determine the acceleration by referring to the mass acceleration diagram and noting the forces acting on the rocket. Then fill out the ellipses of the summative force equation with the appropriate forces, then solve it for a.

Next work out v(t) and h(t) from the previous equations, 1 and 2.
v0 and s0 both equal zero in this case

In the MATLAB program this segment starts at t = 0 and loops while t < 0.25s. At t = 0.25 s time, velocity and height become t1, v1 and h1.

b) Segment Two

The motion of the rocket from when the rocket engine stops firing, or runs out of fuel, until the parachute opens. The rocket moves with a constant deceleration of g. Now the equations for v(t) and h(t) alter to become:

v(t) = v1- g(t - t1) and h(t) = h1 + v1 (t - t1) - ½g (t - t1)2

The iteration continues until the velocity is 20 m/s but note that as we are plotting speed against time we really need to consider direction too so that this is really negative (-)20 m/s (v2) since the rocket is falling downwards, that is, in a negative direction. At the end of this segment two, the time, velocity and height become t2, v2 and h2.

c) Segment Three

The motion of the rocket from when the parachute opens until the rocket hits the ground. The rocket now moves with a constant velocity of -20m/s but zero acceleration. Now the equations for v(t) and h(t) alter to become:

v(t) = -20 and h (t) = h1 - vchute (t- t2)

The loop continues to iterate so long as height is > zero.

PART D: Einstein's Special Relativity

According to special relativity, a metallic rod of initial length L, when at rest, will when travelling at a velocity v through outer space, shrink by an amount δ(meters) according to the following formula:

δ = L [1 - √{1 - (v2/c2)}

where c = 300 x 106m/s (the speed of light)
L = initial length of object in meters when at rest
v= velocity of object in meters/ second

Imagine a rod with an initial length of 30 metres travels through outer space and reaches 90% of the speed of light, c. At this time how long is the rod?

a) define in MATLAB: c = 300 x 106, L = 30 and v = 0.90 x c

b) With the above formula calculate δ(meters).

c) Using δ find the overall length of the rod in metres and hence, answer the question: "At this time how long is the rod?"

PART E: Moment Magnitude Scale

The Moment Magnitude Scale (MMS), MW, measures the total energy released by an earthquake and is represented by the following formula:

MW = (2 log10 M0 / 3) - 10.7

Where M0 = size or magnitude of the seismic moment in N · m (107 dyne - cm) and the subscript W = mechanical work accomplished

In this question you need to determine how many times more energy was released from the Great Chilean earthquake on 22 May 1960, which was the largest earthquake ever recorded in the world with a 9.5 rating on the MMS and the famous Canterbury earthquake which occurred in NZ on 22 February 2011 with a MMS rating of 6.3.

a) Define in MATLAB : MW_Canterbury = 6.3 and MW_Chile = 9.5 using variable names of your own choice for the two quakes.

b) Make M0 the subject of the formula above and write a simple script or function to calculate the energy released from one earthquake. Use a reasonable value for MW to test your script, for example, a value between 3 and 11.

If you write a function then make MW the input parameter and M0 the return variable in your function definition line. Then call your function at command-line level to test it with a value for MW.

c) Using your script or function from sub-part (b) work out the ratio of the energy released from the two earthquakes from part (a) and hence, answer the question: "How many times more energy was released from the Great Chilean earthquake than the famous Canterbury earthquake?"

PART F: Damped Harmonic Motion

Plotting the Amplitude of motion of Damped Harmonic Motion of a Spring- weighted Object

A mass hung below a wall-mounted spring is released and then drops before rising again in an oscillating or repetitive manner at an ordinary frequency, f (Hz). The distance or gap between the drops and rises reduces with time with a constant of proportionality of k.

Therefore, the amplitude reduces reducing from the maximum amplitude A at t0 to zero at time t. This process is called damped harmonic motion, an oscillatory or sinusoidal motion that diminishes over time. Note that small values of k cause a longer decay over a given time and larger values cause a shorter decay over a smaller time.

For damped harmonic motion the amplitude of motion is given by:

Using the above formula for amplitude of motion create a plot similar to Figure 1. Make sure that you label your graph and colour the plot in red using a solid line.

Attachment:- MAT-LAB-Assignment.pdf

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M92475948

Have any Question?


Related Questions in MATLAB

What comparison of means test was used to answer the

What comparison of means test was used to answer the question

Question 1 manipulate spectral imagehyperspectral images

Question 1. Manipulate spectral image Hyperspectral images can be seen as a generalisation of normal colour images such as RGB images. In a normal RGB colour image, there are 3 channels, i.e. channels for red colour, gre ...

Assignment -data is given on which want to do computational

Assignment - Data is given on which want to do computational production planning using Metaheuristic MATLAB Programming: 1) Ant Colony Algorithm on both Partial and Total Flexible Problem. 2) Bee Algorithm on both Partia ...

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignment -we have daily gridded rainfall data of 40 years

Assignment - We have daily gridded rainfall data of 40 years and structure of the dataset is like below; Lat = [6.5:0.25:38.5]; Lon = [66.5:0.25:100]; Rainfall (135x129x365x40) (Lon, Lat, days, years). Now, we looking fo ...

Question - verify the attached paper with matlab and get

Question - Verify the attached paper with matlab and get all the results in the paper and explain step by step the matlab code. Paper - Improving Massive MIMO Belief Propagation Detector with Deep Neural Network. Attachm ...

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Recitation problems -1 determine the highest real root of

Recitation Problems - 1. Determine the highest real root of f(x) = 2x 3 - 11.7x 2 + 17.7x - 5 using the Newton-Raphson method with at least four iterations. Start with an initial guess of x 0 = 3. 2. Determine the real r ...

Suppose that you have used some concept learning algorithm

Suppose that you have used some concept learning algorithm to learn a hypothesis h1 from some training data. You are interested in knowing the accuracy that the hypothesis can be expected to achieve on the underlying pop ...

Prepare a 3 - 10 pages long reportprepare a presentation

Prepare a 3 - 10 pages long report Prepare a presentation with 5 - 9 slides. The slides will include introduction (need and similar work), theoretical background (tested neural networks), Data, Results (Comparison of the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As