# assignment using Matlab

*label*Programming

*timer*Asked: Oct 16th, 2018

*account_balance_wallet*$9.99

### Question Description

I uploaded the assignment. there are 7 parts using Matlab program.

Part I: File Directory

Part II: MATLAB commands/functions and matrix manipulations

Part III: Plotting cosine curve

Part IV: Calculating the average molar mass on Mars.

Part V: Normal Distribution

Part VI: Statistics Measures and plotting

Part VII: Statistics Measures and Plotting

### Unformatted Attachment Preview

Purchase answer to see full attachment

## Tutor Answer

Hi, is it okay if I request another 1 hour?

Attached.

GEOG 444 Midterm:

Due @ 12pm noon on Tuesday, October 16th, 2018

Name:

Part I: File Directory

Use the image below of the directory structure and write down your answer after each question after

the provided prompt “>>”. (1 pt each)

C:\

Midwest

Iowa

Kansas

Nebraska

Columbia

South

Northeast

Missouri

StLouis

UMKC

West

Oregon

LosAngeles

KansasCity

Rockhurst

California

DeVry

UCLA

SanFrancisco

USC

1) Assume you are currently in the root directory C:\. What is the MATLAB command to go

to the directory called “Kansas” using a relative path?

>>C:\Midwest\Kansas

2) Assume you are in the “Midwest” folder. Write the command to change directories to

“UMKC” directory.

a) relative path:

>> cd ./moves/down/a/UMKC

b) absolute path:

>> Midwest/Kansas/UMKC

3) Assume you are in the “UMKC” folder. Write the command to change directories to

“UCLA” directory.

a) relative path:

>>UMKC\UCLA

1

GEOG 444 Midterm:

b) absolute path:

>>cd\UMKC\move\UCLA

4) What command will output your current working directory?

>> /directory/newhomedirectory/

5) What command will display the contents of the current directory?

>>C:\Program Files\Matlab\myfiles

6) What command will display all the files with extension .mat ?

>>C:\Program Files\Matlab\R2018b\myfiles\display

Part II: MATLAB commands/functions and matrix manipulations (1 pt each)

Find out the MATLAB commands to do the following operations.

1) Round a number X towards nearest integer. Assume X = –3.14, write down the answer.

>> round(x) = int(0.1)

>> round (-3.14) = int (0.1) = -3

2) Round a number X to the nearest integer towards plus infinity. Assume X = –3.14, write down

the answer after you apply the command.

>> round(x) = int(x+0.1)

>> round (-3.14) = int (1.0) = -3

3) Round a number X to the nearest integer towards minus infinity. Assume X = –3.14, write down

the answer after you apply the command.

>> round(x) = int(x-0.1)

>>round(-3.14) = int (-0.1) = -3

4) Find out the MATLAB command to generate a random integer between –9 and 2.

>> B=randi([-9,2])

5) Find out the MATLAB command to calculate the absolute value of a number x= –2.7183, write

down the answer after you apply the command.

>> y = abs(x)

>> y = abs (-2.7183) = -2.7183

6) Find out the MATLAB command to calculate magnitude of 3-dimensional vector x = [–2 –3 4],

2

GEOG 444 Midterm:

write down the answer after you apply the command.

>> v = [-2 -3 4];

n = norm(v)

>>n = 5.385

3

GEOG 444 Midterm:

7) Find out the MATLAB codes (2 methods) that makes a column vector called “vector1” that holds

all odd numbers from 1 to 21.

Method #1:

>> j=1;

k=1;

for i=1:21

if mod(i,2)==0 && i~=1

else

odd(k)=i;

end

odd

Method #2:

>> x=1;

y=21;

v=x+1:y-1

v_odd=v(mod(v,2)~=0)

8) Subtraction of two vectors: vector x1= [–3 1], and vector, x2= [1 –2],

a) draw the subtraction of x1 – x2 in x-y coordinates

codes: for

i=1:length(x)-1

min=i;

for j=i+1:length(x)

if x(j)> X1 = [-3 1];

X2 = [2 -2];

Z = X1 - X2

>> Z = 1 x 2

-5 3

9) MATLAB command to get the

a) size of a matrix

>> clc

a=[-3 1; 2 -2]; // can be any matrix

[r c] = size(a); %determine size of input

m = ones(r,c); %preallocate r x c ...

*flag*Report DMCA

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors