Questions: 150

Answers by our Experts: 150

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Modify the power method so that the stopping condition is changed to

| ((Axn-un xn)/|Xn|) | <tolerance

where xn, μn are the current estimates of the eigenvector and eigenvalue. Demonstrate the validity of your code by running it on the matrix

3 -1 0

-1 2 -1

0 -1 3


A simple text-based version of a grid game such as battleship or mine-sweeper.

This is the criteria:
The code that you use to produce that application must use a combination of at least two of:

Loops
Vectors or Arrays
Conditional execution
Optionally, your code might embed:

Functions.
Visualisation of data
A simple card game such as twenty-one
(Link for refreshing : https://en.wikipedia.org/wiki/Twenty-One_(card_game))

This is criteria :
The code that you use to produce that application must use a combination of at least two of:

Loops
Vectors or Arrays
Conditional execution
Optionally, your code might embed:

Functions.
Visualisation of data

Definition

For this question we have to write MATLAB code to detect a scalene triangle by reading in three numerical values representing the lengths of the three sides and printing “it’s a scalene” if the triangle is not an isosceles or equilateral triangle and the sum of any two side’s length is greater than the length of the other side.

Testing

On paper, or in a text file, write three new tests for the above program. As an example, three tests for this program might be.

inputs output
5 5 5  <no output>
2 1 2  <no output>
3 2 1  <no output>
3 4 5  “it’s a scalene”

Coding

If you are sharing a computer, swap a new group member to the terminal. Write a MATLAB script called q6.m that implements the definition above using at least if-statements. 


Definition:

In this question we define code that reads in three positive numbers representing the lengths of the sides of a triangle and prints out a message saying “it’s equilateral” if all three sides are of equal length.


Testing:

On paper, or in a text file, write three new tests for the above program. As an example, two tests for this program might be.


inputs output
5 5 5  “it’s equilateral”
2 1 2  <no output>

If there is a group of x people in a room, what is the probability that two or more of them have the same birthday? It is possible to determine the answer to this question by simulation.


a) Make a getRandom function , then edit as follows to:  Take as input n, which is the maximum random number that may be generated  Return (output) a number in the range 1 to n Tip: Still use the round(rand()) construct, but this time, you are multiplying by n and adding 1. (note that you are NOT using the randi built-in function here!)


2 b) Write a new getRandomArray function :  Take as input the number of people in a room (x) and the maximum number that can be used (n)  Return an array of b numbers (i.e. the birthdays)  Use the getRandom function to generate a random birthday for each person, from 1 to n Tip: initialise x and use a loop to generate the required number of elements and build the array.


Write a MATLAB code to solve the following problem.

The forced oscillations of a body of mass m on a spring of modulus k are

governed by the ODE

my" +cy' +ky = r

Find the steady-state solution for y(t), if m = 1 kg, c == 0.05g/sec and k =

25 g/sec. Where,

r(t) = {t + pi/2 -pi <= t <= 0; t - pi/2 0 <= t <= pi }

where, r(t) = r(t + 2pi).



Write a MATLAB code to calculate and plot the following problem.

Rectifier: Find the Fourier series of the function obtained by passing the

voltage v(t) = 10 sin(100xt)through a half-wave rectifier that clips the negative

half-waves.



The graph of a function 

𝑓(𝑥) = 𝑝𝑥

4 + 𝑞𝑥

3 + 𝑟𝑥

2 + 𝑠𝑥 + 𝑡

passes through the points ( 2.5, 62 ) , ( 1.5, 7.2 ) , ( 0.5, 8.3) , ( -1, -3.7 ) and ( -3, -45.7) . Write 

a program that determine the values of constants 𝑝, 𝑞, 𝑟, 𝑠,𝑡.


Write a program to find the acceleration of the object at a point ( 2, 3 ) using Matlab symbolic 

tool box commands. The particle position function is following. [2]

𝑠(𝑡) = 2𝑡

4 − 7cos(𝑡) + 𝑒

−2𝑡


LATEST TUTORIALS
APPROVED BY CLIENTS