Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask MATLAB Expert

Tasks:

problem 1: Practice Vector Manipulation

prepare single MATLAB statements to create these vectors from any vector Z. You can use vector Z shown as a sample input. Create a single m-file script (non-function) to containing all the statements. Comment each problem 'a' through 'e' in your m-file.

Z = [4 5 2 8 4 7 2 64 2 57 2 45 7 43 2 5 7 3 3 6523 3 4 3 0 -65 -343];

a) Create a new vector vecA that is the odd numbered elements of Z (not the odd values, the elements with odd indexes).

b) Count how many elements of Z are less than or equal to 10.

c) Create a new vector vecC that is the same as Z except all the odd values of Z are changed to even by adding 1 to them.

d) prepare a single MATLAB statement to generate 100 random integers with values -1 or 0 or 1.

e) Create a new vector vecE that contains all the elements of Z that are a multiple of 3

f) Create a new vector vecF that is the same as Z except the first and last elements are swapped and nothing else is changed.

g) find out how many elements of Z are within 10 of the max element in Z (include the max element(s) in your count).

h) Create a new vector vecH that has the sum of the first and second elements of Z in the first position of vecH, the sum second and third elements of Z in the second position of vecH, the sum third and fourth elements of Z in the third position of vecH, etc. The last element of vecHis just the last elementof Z.

problem 2: Create m-file functions to solve some basic vector problems in MATLAB.

For each problem complete the following steps:

A) Draw a picture or prepare pseudocode for solving the problem using composition (you do not have to hand this in)

B) By hand, make an estimate of roughly the scale of the answer (you do not have to hand this in).

C) prepare an m-file function to solve the problem.

D) Test your m-file function using MATLAB in "calculator" mode with the diary on to save all your work in a command history file. It is fine to include errors in your command history file, as long as you eventually compute correctly. If you discover mistakes in your program, correct them and execute again. Please format the results to significant digits that are correct for the problem and data given.

How to create a command history file??

>> diary BauerLab6.txt
. . .
>> diary off

Problems:

A) You are asked to determine the most efficient solid shape (defined by the shape with largest ratio of volume to its surface area) for a large hot air balloon. prepare a matlab script m-file named Efficient.m (function not necessary) to create a vector containing the ratios of the volume of a sphere to the surface area for a sphere for radius "r" values ranging from 50 to 100 by 2s.

Do the same thing for the volume and surface area of a cube with side length "r" values ranging from 50 to 100 by 2s

Do the same thing for the volume and surface area of a tetrahedron (equilateral triangle based pyramid) with side length "r" values ranging from 50 to 100 by 2s.

Finally, plot the three vectors of ratios on the same graph, x-axis is the "r" vector, y-axis is the ratio of volume to surface area vector. Use different colors or symbols for each plot, label the axes, and add a legend. Which solid shape shape is most efficient (most volume per surface area)?

B) A vector 'v' stores for the letter grades ('A', 'B', 'C', 'D', 'E') for a student's classes for a term. A student can have from 1 to 6 classes. Assume every class is a 3 credit hour class and assume each grade is worth this many grade points. A = 4, B = 3, C = 2, D = 1, E = 0 prepare a function call myGPA that has a single vector argument of grades as described above, and find outs and returns the GPA for the term. NO IF STATEMENTS ARE NEEDED, use vector conditions/manipulations) Sample call and result:

>> GPA = myGPA(['B' 'A' 'A' 'C' 'B'])
GPA =
3.2000

MATLAB, Engineering

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

Have any Question?


Related Questions in MATLAB

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

Assignmentafter the success of your robo-advice venture you

Assignment After the success of your robo-advice venture you decide to explore alternative sources of profitability for your company. You realize that Australian investors are often forced to chose between expensive acti ...

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

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

Lab assignment - matlab matrix relationallogical operators

Lab Assignment - MATLAB Matrix, Relational/Logical Operators and Plotting This laboratory exercise/assignment will involve you 1) practicing multiplication operators in MATLAB; 2) practicing relational and logical operat ...

What comparison of means test was used to answer the

What comparison of means test was used to answer the question

Assignment -matlab codes and simulated model in

Assignment - Matlab codes and simulated model in simulink/matlab and truetime. 1. Matlab codes and simulink model for pid controller optimization using particle swarm optimization (PSO) my plant is integer order 1000/(s^ ...

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

  • 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