MATLAB assignment

User Generated

QNA23

Engineering

Description

Complete the following problems in a Single Script File in MATLAB program

I attached the files that have the problems

I hope all things are clear

Unformatted Attachment Preview

5. Write a MATLAB program that generates a vector with 20 random elements between 10 and 10 and then finds the sum of the positive elements. 6. The Sierpinski triangle can be made in MATLAB by plotting points iteratively according to one of the following three rules that are selected randomly with equal probability. Rule 1: Xx+1=0.5x Yn+1 = 0.5% Rule 2: *n+1 = 0.5x, +0.25 Yn+1 = 0.5y + (13)/4 Rule 3: Xn+1 = 0.5Xn + 0.5 Yn+1 = 0.5 Write a MATLAB program that calculates the x and y vectors and then plots y versus x as individual triangular points. Start with x 20 and y=0. Run the program four times with 10, 100, 1000, and 10,000 iterations and have each figure show. 7. Write a script file that creates an nxm matrix with elements that must have the following values. The value of each element in the first row is the number of the column and the value of each element in the first column is the number of the row. The rest of the elements each have a value equal to the sum of the element above it and to the left of it. The program should ask the use to enter values for n and m. ENGR 102 In-Class/Homework 9 Write the code to solve the following equations in a single script file. 1. Solve the following system of equations. -a-2b + 4c = -19 -2 - 5c =23 a-b-c = 16 2. A food company manufactures five types of 8-oz trail mix packages using different mixtures of peanuts, almonds, walnuts, raisins, and M&Ms. The mixtures have the following compositions: Peanuts Almonds Walnuts Raisins M&Ms (oz) (oz) (oz) (oz) (oz) Mix 1 3 1 2 1 Mix 2 2 1 Mix 3 3 Mix 4 0 3 2 Mix 5 2 3 2 1 1 2 1 1 0 3 3 1 1 0 1 How many packages of each mix can be manufactured if 105 lbs of peanuts, 74 lbs of almonds, 102 lbs of walnuts, 118 lbs of raisins, and 121 lbs of M&Ms are available? Write a system of linear equations and solve 3. Fibonacci numbers are the numbers in a sequence in which the first two elements are 0 and 1, and the values of each subsequent element is the sum of the previous two elements. (0,1,1, 2, 3, 5, 8, 13,....). Write a MATLAB program in a script file that determines and displays the first 20 Fibonacci numbers. 4. The value of pi can be estimated by the following equation: 1 Write a MATLAB program that uses a loop to determine the value of the above expression. Have the program fun for values of n=10, n=100, n=1000, and n=10000. The value of expression at each n value should display.
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

This is the script fil...


Anonymous
Very useful material for studying!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags