Ask Question, Ask an Expert

+1-415-315-9853

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

Problem - the state estimation equation in the discrete

Problem - The state estimation equation in the discrete Kalman filter is x ^ (n|n) = A(n - 1)x ^ (n - 1|n - 1) + K(n)[y(n) - C(n)A(n - 1)x ^ (n - 1|n - 1)] Thus, given the state transition matrix A(n) and the observation ...

Part -1introduction to programming with matlab1 the

Part -1: Introduction to Programming with MATLAB 1. The function move_me is defined like this: function w = move_me(v,a). The first input argument v is a row-vector, while a is a scalar. The function moves every element ...

Introduction to programming in matlab1 working with matlab

Introduction to Programming in MATLAB 1. Working with MATLAB scalars, vectors, and complex numbers. Using MATLAB, define a unique variable for the following quantities. a. 5 (ex. Define x = 5, etc.) b. 25 2 c. (3 + 4??) ...

It is desired to design a power electronic system referred

It is desired to design a power electronic system, referred to as ‘the device' in below, which has the following specifications: - The device is supplied from a single-phase wall outlet which has a 240 V rms, 50 Hz speci ...

Topic matlab coding signals and systems sampling fourier

Topic: MATLAB coding, signals and systems, sampling, Fourier analysis, FFT, new transform techniques Purpose of the assessment: The purpose of this assignment is to motivate students to learn MATLAB programming and how t ...

Problem -the state estimation equation in the discrete

Problem - The state estimation equation in the discrete Kalman filter is x ^ (n|n) = A(n - 1)x ^ (n - 1|n - 1) + K(n)[y(n) - C(n)A(n - 1)x ^ (n - 1|n - 1)] Thus, given the state transition matrix A(n) and the observation ...

Algorithms assignmentthe following 3 tasks are to be

Algorithms Assignment The following 3 tasks are to be completed for Homework 1 - using the following MATLAB syntax for the script file "bike.m" 1) Write additional syntax to create an INPUT variable named time and prompt ...

Problem 1 the two foremost aerospace companies in the usa

PROBLEM 1: The two foremost aerospace companies in the USA are Lockheed and Boeing. They often compete for government contracts. A major factor in awarding a contract is the claimed reliability of the given system to be ...

1 write a matlab script that will solve the system of

1. Write a Matlab script that will solve the system of linear equations shown below. This can be done by solving for the vector of unknowns (X) in the equation AX=B where A is the coefficient matrix and B is the vector o ...

Project 1complete parts 1a 1b and 1cprepare a report

Project 1 Complete parts 1A, 1B, and 1C Prepare a report describing your steps and results Send by email a zip or rar file that contains the report and all MATLAB files you have used. Project 1A: In this project, we cons ...

  • 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

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate