Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask MATLAB Expert

Assignment

Write the scripts (m-files) in Matlab for the following questions. Write only one script using cell structure.

Q1 A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 1, 1 and proceeds as follows:

1, 1, 2, 3, 5, 8, 13, ...

However, a Fibonacci sequence can be created with any two starting numbers. Prompt the user to enter the first two numbers in a Fibonacci sequence and the total number of elements requested for the sequence. Find the sequence and store it in an array by using a for loop. Now plot your results on a polar graph. Use the element number for the angle and the value of the element in the sequence for the radius.

Q2 The value of cos(x) can be approximated using a Maclaurin series which can be expressed more compactly as

cos (x) = 1 - (x2/2!) + (x4/4!) - (x6/6!) + ...

(recall that the symbol ! stands for factorial).

k=1 (-1)k-1 [x(k-1)*2 / (k-1)*2)!]

Use a midpoint break loop to determine how many terms must be included in the summation, in order to find the correct value of cos(2) within an error of 0.001. Limit the number of iterations to a maximum of 15.

Q3 A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 1, 1 and proceeds as follows:

1, 1, 2, 3, 5, 8, 13, ...

One interesting property of a Fibonacci sequence is that the ratio of the values of adjacent members of the sequence approaches a number called "the golden ratio" or (phi). Create a program that accepts the first two numbers of a Fibonacci sequence as user input and then calculates additional values in the sequence until the ratio of adjacent values converges to within 0.001. You can do this in a while loop by comparing the ratio of element k to element k - 1 and the ratio of element k - 1 to element k - 2. If you call your sequence x, then the code for the while statement is

while abs(x(k)/x(k-1) - x(k-1)/x(k-2))>0.001

Q4 The value of sin(x) can be approximated as

sin (x) = x - (x3/3!) + (x5/5!) - (x7/7!) + ...

Create a function called my_sin, using a midpoint break loop to approximate the value of sin(x). Determine convergence by comparing successive values of the summation as you add additional terms. These successive sums should be within an absolute value of 0.001 of each other. Limit the number of iterations to a maximum of 30.

Q5 The le lake_powell.dat contains data on the water level in the reservoir of Lake Powell for the 8 years from 2000 to 2007. By using a nested loop structure,

Determine the average elevation of the water level for each year and for the eight-year period over which the data were collected.

Q6 Consider the following method to approximate the mathematical constant, e. Start by generating K uniform random integers between 1 and K. Compute J, the number of integers between 1 and K, which were never generated. We then approximate e by the ratio

K/J

Consider the following example for K = 5. Assume that the following five integers are randomly generated between 1 and 5.

The number of times the integers are generated is given by

Integers

1

2

3

4

5

Number of instances

2

2

1

0

0

In this example, there are two integers, namely 4 and 5, which were never generated. This means that J = 2. Consequently, e is approximated by

5/2 = 2.5

Write a function called eapprox that takes the value of K as input, and which then approximates e using the method described above.

Q7 The le lake_powell.dat contains data on the water level in the reservoir of Lake Powell for the 8 years from 2000 to 2007. By using a nested loop structure, Determine how many months each year exceed the overall average for the eight-year period.

Q8 Most major airports have separate lots for long-term and short-term parking. The cost to park depends on the lot you select, and how long you stay. Consider this rate structure from the Salt Lake International Airport during the summer of 2008.

• Long-Term (Economy) Parking

- The first hour is $1.00, and each additional hour is $1.00
- Daily maximum $6.00
- Weekly maximum $42.00

• Short-Term Parking

- The first 30 minutes are free and each additional 20 minutes is $1.00
- Daily maximum $25.00

Write a program that asks the user the following:

• Which lot are you using?
• How many weeks, hours, days, and minutes did you park? Your program should then calculate the parking bill.

Q9 The le lake_powell.dat contains data on the water level in the reservoir of Lake Powell for the 8 years from 2000 to 2007. By using a nested loop structure,

Create a report that lists the month (number) and the year for each of the months that exceed the overall average. For example, June is month 6.

Q10 Develop a function called diagonal to find the main diagonal vector of a matrix with nested loops. Developed function should have the same result as Matlab built-in function diag.

 

Q1-Q2

Q3-Q4

Q5-Q6

Q7-Q8

Q9-Q10

Student Number

10042025

15065221

16012060

16012132

16065209

14012610

16012010

16012067

16012620

16073005

14035023

16012016

16012068

16015057

17012040

15012010

16012031

16012078

16041024

17012071

15012022

16012032

16012081

16051002

17012609

15024909

16012033

16012109

16065025

17012907

15035014

16012044

16012116

16065081

17041029

15065108

16012051

16012127

16065089

17056010

15065149

16012054

16012130

16065154

17065075

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



 

MATLAB, Engineering

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

Have any Question?


Related Questions in MATLAB

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 ...

What comparison of means test was used to answer the

What comparison of means test was used to answer the question

Discrete optimisation- solve the following two problems

Discrete Optimisation - Solve the following two problems with both exhaustive enumeration and branch and bound - Problem 1 is a mixed integer linear optimisation problem (the problem has both discrete and continuous vari ...

Assignmentq1 find the laplace transforms of the following

Assignment Q.1 Find the Laplace transforms of the following functions: (a) t 2 + at + b and (b) sin(2nΠt/T) Q.2 Find f (t) for the following F(s) = α[ f (t)]. (i) 5/(s + 3), (ii) 1/s 2 + 25, (iii) 1/s(s+1) Q.3 Find the L ...

Suppose that a student has the option of enrolling for a

Suppose that a student has the option of enrolling for a single elective during a term. The student must select a course from a limited list of options: "English, " "History, " "Biology, " "Computer, " or "Math." Constru ...

Assignment details -need to write a code for connecting

Assignment Details - Need to write a code for connecting segments (Lines) a special case of TSP. The problem is to connect lines in 2d/ 3d space with path obstructions. Can you help me write the code for this? Hope you m ...

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 ...

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 ...

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 -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 ...

  • 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