1

Compute the following problems using Math Lab.   Instructions: Answer All Questions using MATLAB commands. Question 1....

Question

Compute the following problems using Math Lab.   Instructions: Answer All Questions using MATLAB commands. Question 1....

Compute the following problems using Math Lab.  Instructions: Answer All Questions using MATLAB commands. Question 1. Create a vector of the even whole numbers between 31 anb.... compute the length of the third side of a triangle given the lengths of the other two sides, given the cosine rule c- a

Instructions: Answer All Questions using MATLAB commands. Question 1. Create a vector of the even whole numbers between 31 and 75. Question 2. Let x [2516] a. Add 16 to each element b. Add 3 to just the odd-index elcments c. Compute the square root of each element d. Compute the square of each element Question 3. Let x 13 268T and y [4 1 3 5] (NB. x and y should be column vectors) a. Add the sum of the elements in x to y b. Raise cach element of x to the power specified by the corresponding element in y c. Divide each element of y by the corresponding element in x d. Multiply each element in x by the corresponding element in y, calling the result "z" f. Compute x *y - w and interpret the result e. Add up the elements in z and assign the result to a variable called "w" Question 4. Evaluate the following MATLAB expressions by hand and use MATLAB to check the answers a. 2/2 *3 b. 6-2/5+72-1 c. 10/215-3+2 4 d. 342/4 e, 3^2^2 f. 2+ round (6/9+32)/2-3 g. 2floor (6/9+3 2)/2-3 h. 2+ceil (6/9+3* 2)/2-3 Question 5. Create a vector x with the elements... b. 10, 8, 6, 4, 2, 0, -2,-4 d. 0, 1/2, 2/3, 3/4, 4/5, Question 6. Create a vector x with the elements, X)(2n-1) Add up the elements of the vcrsion of this vector that has 100 elements. Question 7. Write down the MATLAB expression(s) that will a.... compute the length of the hypotenuse of a right triangle given the lengths of the other two sides (try to do this for a vector of sidc-length values)
b.... compute the length of the third side of a triangle given the lengths of the other two sides, given the cosine rule c- a +b'- 2(a)*(b) cos(t) where t is the included angle between the given sides. Question 8. Given a vector, t, of length n, write down the MATLAB expressions that will correctly compute the following: a. In (2 +t2) b. e( cos(3t)) c. cos2 (t)+ sin2(t) d. tan (this is the inverse tangent function) e. cot (t) f. sec (t)+cot(t) 1 Test that your solution works for 1:02: 2 Question 9. Plot the functions x, x3, e and c2 over the interval 0<x <4... Question 10. Make a good plot (i.e., a non-choppy plot) of the function F(x)-sin(1/x) for 0.01 x 0.1. Explain how you created 'x' so that the plot looked good?

Answers

>> % question 1
>> even_whole = 31+1:2:75

even_whole =

Columns 1 through 11

32 34 36 38 40 42 44 46 48 50 52

Columns 12 through 22

54 56 58 60 62 64 66 68 70 72 74

>> % question 2
>> x = [2 5 1 6];
>> % a
>> x+16

ans =

18 21 17 22

>> % b
x = [2 5 1 6];
x(1)=x(1)+3;
x(3)=x(3)+3;
x

x =

5 5 4 6

>> % c
x = [2 5 1 6];
sqrt(x)

ans =

1.4142 2.2361 1.0000 2.4495

>> % d
>> x.^2

ans =

4 25 1 36

% question 3
>> x = [3 2 6 8]' , y = [4 1 3 5]'

x =

3
2
6
8


y =

4
1
3
5

>> sum(x)+ sum(y)

ans =

32

>> % b
>> x.^y

ans =

81
2
216
32768

>> % c
>> y./x

ans =

1.3333
0.5000
0.5000
0.6250

>> % d
>> x.*y

ans =

12
2
18
40

>> z=x.*y;
>> % e
>> x=sum(z)

x =

72

>> w=sum(z);
>> x = [3 2 6 8]'

x =

3
2
6
8

>> % f
>> x'*y-sum(z)

ans =

0

>> % question 4
>> % a
>> 2/2*3

ans =

3

>> 6-2/5+7^2-1

ans =

53.6000

>> 10/2\5-3+2*4

ans =

6

>> 3^2/4

ans =

2.2500

>> 3^2^2

ans =

81

>> 2+round(6/9+3*2)/2-3

ans =

2.5000

>> 2+floor(6/9+3*2)/2-3

ans =

2

>> 2+ceil(6/9+3*2)/2-3

ans =

2.5000

>> % question 5
>> x = 2:2:20 % insteal of 20 one could put bigger number

x =

2 4 6 8 10 12 14 16 18 20

>> % b
>> clear x
>> x = 10:-2:-4

x =

10 8 6 4 2 0 -2 -4

>> %c
>> clear x
>> x = 1:20;
>> x = 1./x

x =

Columns 1 through 6

1.0000 0.5000 0.3333 0.2500 0.2000 0.1667

Columns 7 through 12

0.1429 0.1250 0.1111 0.1000 0.0909 0.0833

Columns 13 through 18

0.0769 0.0714 0.0667 0.0625 0.0588 0.0556

Columns 19 through 20

0.0526 0.0500

>> % d
>> clear x
>> x = 0:20;
>> y = x+1;
>> x = x./y

x =

Columns 1 through 6

0 0.5000 0.6667 0.7500 0.8000 0.8333

Columns 7 through 12

0.8571 0.8750 0.8889 0.9000 0.9091 0.9167

Columns 13 through 18

0.9231 0.9286 0.9333 0.9375 0.9412 0.9444

Columns 19 through 21

0.9474 0.9500 0.9524

>> % question 6
>> xn = @(n) (-1)^(n+1)/(2*n-1);
>> xn

xn =

function_handle with value:

@(n)(-1)^(n+1)/(2*n-1)

>> % question 7
>> % function handle for hypoteneous
>> f = @(a,b) sqrt(a.^2,b.^2);
>> f

f =

function_handle with value:

@(a,b)sqrt(a.^2,b.^2)

>> for i=1:100 x(i)=xn(i); end
sum(x)

ans =

0.7829

>> % question 7
>> % function handle for hypoteneous
>> f = @(a,b) sqrt(a.^2+b.^2);
>> f

f =

function_handle with value:

@(a,b)sqrt(a.^2+b.^2)

>> % function handle for cosine rule
>> g = @(a,b,t) a.^2 + b.^2 -2.*b.*a.*cos(t);
>> g

g =

function_handle with value:

@(a,b,t)a.^2+b.^2-2.*b.*a.*cos(t)

% question 9
x=linspace(0,4);
>> subplot(2,2,1); plot(x,x,'r--'); title('x');...
subplot(2,2,2); plot(x,x.^3,'k--'); title('x^3');...
subplot(2,2,3); plot(x,exp(x),'c-.'); title('exp(x)');...
subplot(2,2,4); plot(x,exp(x.^2),'g--'); title('exp(x^2)');

80 60 40 20 exp(x) 0 exp(x2) 60 10 106 40 20 0

>> % question 10
>> x = linspace(0.01,0.1,1000); % linspace divide interval into 1000 equal segments
>> plot(x,sin(1./x))

0.8 0.6 0.4 0.2 0 -0.2 0.4 -0.6 -0.8 -1 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11


Similar Solved Questions

1 answers
Question 13 5 pts A far-sighted person can see his iPhone clearly only if he holds...
Question 13 5 pts A far-sighted person can see his iPhone clearly only if he holds it 40 cm away a farther from his eyes. What should be the prescription of his contact lenses, if he wants to clearly see his phone at a distance of 25 cm? O +1.5 D 0 -1.5 D 0 +6.5D O -6.5 D O -2.4D...
1 answers
Consider the following unbalanced equation: H2SO4(aq)+Fe(s)H2(g) + Fe2(SO4)3(aq) If 17.6 moles of H2SO4 ( aq) and...
Consider the following unbalanced equation: H2SO4(aq)+Fe(s)H2(g) + Fe2(SO4)3(aq) If 17.6 moles of H2SO4 ( aq) and 10.2 moles of Fe(s) are allowed to react, what is the theoretical yield of H2(g) in moles? 21.0 moles 88.4 moles 81.7 moles 15.3 moles 12.3 moles Use the slider to rate your confidence o...
1 answers
Your Pizza is a small pizzeria at Tuskegee, AL. In the table following, the difference in...
Your Pizza is a small pizzeria at Tuskegee, AL. In the table following, the difference in cost structure is summarized. Note that both plants are assumed to have the same labor costs of $400 per week, the same fixed cost of $1,000 per oven per week, and the same opportunity cost of $500 per week. No...
1 answers
How do you solve #log 5 = (x+1) log 4#?
How do you solve #log 5 = (x+1) log 4#?...
1 answers
Write the condensed electron configuration: Re Re^4+ Re^6+ Re^7+
write the condensed electron configuration: Re Re^4+ Re^6+ Re^7+...
1 answers
Q3. (10 POINTS) Given the following temperature and elevation data, determine the stability of the atmosphere....
Q3. (10 POINTS) Given the following temperature and elevation data, determine the stability of the atmosphere. Elevation (m) 10 50 100 150 200 250 300 Temperature (°C) 14.25 13.85 13.35 12.85 12.35 11.85 11.11...
1 answers
What is the value today of $1,800 per year, at a discount rate of 10 percent,...
What is the value today of $1,800 per year, at a discount rate of 10 percent, if the first payment is received 8 years from now and the last payment is received 32 years from today?...
1 answers
Calculate the change in Entropy 3. One mole of CO gas is transformed from an initial...
Calculate the change in Entropy 3. One mole of CO gas is transformed from an initial state of Ti=320K and Vi=20L to a final state of Tf=650K and Vf=120L. The temperature dependence of Cv,m is given as C = a +bT +cT? +dT”; a=31.08, b=-0.01452K-'; c=3.14x10--K?,b=-1.498x10K-...
1 answers
The moon is 3.5 x 10 m in diameter and 3.8 x 108 m from the...
The moon is 3.5 x 10 m in diameter and 3.8 x 108 m from the earth's surface. The 1.8-m-focal length converging mirror of a telescope focuses an image of the moon onto a detector. Part A What is the diameter of the moon's image? Express your answer with the appropriate units. xa x d' = -....
1 answers
Find the equation of the line which passes through the point (-4,4), and is perpendicular to...
Find the equation of the line which passes through the point (-4,4), and is perpendicular to the line with the equation y = --x+ 4. Express your answer in slope-intercept form. Simplify your answer. 4 1...
1 answers
Physics
You and your friend Peter are putting new shingles on the roof pitched at 25 degrees. You're siting on the very top of the roof when Peter, who is at the edge of theroof directly below you, 5.0m away, asks you for the box of nails. Rather than carry the 2.5kg box of nails down to Peter, you deci...
1 answers
Exercise 02: Based on LINQ extension methods. [15 marks] Create an Invoice class which includes four...
Exercise 02: Based on LINQ extension methods. [15 marks] Create an Invoice class which includes four properties - a PartNumber ( type int), a PartDescription ( type string), a Quantity of item being purchased (type int) and a Pricel type decimal). Use the following sample data for Invoice class obje...
1 answers
Listed below are the amounts of net worth (in millions of dollars) of the ten wealthiest...
Listed below are the amounts of net worth (in millions of dollars) of the ten wealthiest celebrities in a country. Construct a 99% confidence interval 247 195 175 174 161 159 154 154 154 What is the confidence interval estimate of the population mean? smillion <<5 million (Round to one decimal...
1 answers
Let F be the vector field represented in the figure: y X 1Q0Y, 1X P(-1, 1)...
Let F be the vector field represented in the figure: y X 1Q0Y, 1X P(-1, 1) X Q3.1 3 Points 2d-Curl F(0,0) > 0 O 2d-Curl F(0,0) = 0 2d-Curl F(0,0) < 0 Q3.2 3 Points OV: F(0,0) > 0 OV: F(0,0) = 0 OV: F(0,0) < 0...
1 answers
2. The cornea is a water-filled connective tissue that we will treat as being flat and...
2. The cornea is a water-filled connective tissue that we will treat as being flat and of thickness h (see below). Because of the composition of the cornea, it traps positive ions, so that there are “excess" positive ions in the interior of the cornea compared with the surrounding fluid co...
1 answers
BJ was forecasting expansion of sales in the Midwest and Western parts of the country. To...
BJ was forecasting expansion of sales in the Midwest and Western parts of the country. To accommodate the forecast growth, it was planning on investing $2.4m over the next 18 months, of which $2m will be spent in 2019 and the remaining amount in 2020. It was anticipated this investment would fulfill...
1 answers
Two parallel conduction 1 and 2 are placed apart. The conduction carry currents of 12.0A and...
Two parallel conduction 1 and 2 are placed apart. The conduction carry currents of 12.0A and 25.0 A respectively. The current in 1 is up while that in 2 down. Point A is 5.0 cm to the left of conductor 1 while is midway between the a) Draw the magnetic field lines due to the two conduction at locati...
1 answers
A:-2MC ( 1m,2m) (1) Find Farce on Ri and红
A:-2MC ( 1m,2m) (1) Find Farce on Ri and红...
1 answers
Please do this in excel and show all the functions. A new grape press was purchased...
please do this in excel and show all the functions. A new grape press was purchased for $150,000. The annual operating and maintenance costs for the press are estimated to be $4,000 the first year. These costs are expected to increase by $5,000 each year after the first year. The market value is ...
1 answers
PYTHON 3. Write code using zip and filter so that these lists (l1 and l2) are...
PYTHON 3. Write code using zip and filter so that these lists (l1 and l2) are combined into one big list and assigned to the variable opposites if they are both longer than 3 characters each. l1 = ['left', 'up', 'front'] l2 = ['right', 'down', 'back']...

-- 0.011144--