Question

Matlab Questions (please show what code I need, including any comments, for each of the questions):...

Matlab Questions (please show what code I need, including any comments, for each of the questions):

1)  Initialize two row vectors a and b of arbitrary but equal lengths (pick any length ³3) with random numbers between 0 and 1. Recalling that the dot product between two vectors is a ∙ b = |a||b| cos theta, calculate the angle, theta, between the two vectors (radians or degrees is fine, just state what you used).

Note: • You can use built-in inverse trigonometric functions from Matlab • You may not use the built-in “dot” and “norm” functions from Matlab • You should not write products like a(1)*b(1)+a(2)*b(2)+…, etc.

2) (Extra credit) Consider vectors a=[1 1 1] and b=[1 -1 1]. These two linearly independent vectors define a plane. Calculate the unit normal to this plane. You can use any Matlab functions you like.

3) There are 100 runners in the Amherst 5k Hot Chocolate race; let’s label them by jersey numbers 1 to 100. To simulate this race, make a 1D array consisting of 100 entries with random finishing times that are uniformly distributed between 20 and 30 minutes. Each entry in this array corresponds to the finishing time for each runner, e.g., entry #29 is the finishing time for runner 29. Using only array operations and/or array functions: a. Print the top three finishing times; your output could look something like this: Top three finishing times: 20.2094 21.6666 21.8455 b. Print the top three runners; your output coould look something like this: Top three runners: 62 37 88 [Hint: zyBooks Sec 6.7] c. If 25 minutes is the qualifying time for the Hampshire county 5k race, use logical operators to calculate how many runners qualified for the county race.

4) You are asked to design a water storage tank with a capacity of 1,000 liters. The tank will be fabricated from stainless steel (rolled sheet), which cost $100/ sq. m. You are asked to consider three possible designs for the tank: Option 1 – a cube; Option 2 – a cylinder; Option 3 – a sphere. Calculate the cost of each of these designs and report the least expensive option.

• You should create a local function that has two inputs: tank capacity (volume) and material cost per sq. m. • Your function should evaluate and report the cost of each option ordered from lowest to highest. The output does not have to be fancy; something like this is adequate: Options: 3 1 2 Pricing ($): 90.8400 100.9100 123.4600 • For the cylinder, you can assume that the height and radius are equal (1 liter = 103 cm3 = 10-3 m3 )

0 0
Add a comment Improve this question Transcribed image text
Answer #1

clc
clear
close
%(1)
a=rand(1,3); % assigning random number to a
b=rand(1,3); % assigning random number to b
theta=acos(sum(a.*b)/sqrt(sum(a.^2)*sum(b.^2))) %theta in radian
%(2)
a=[1 1 1]; b=[1 -1 1];
UNv=cross(a,b)/sqrt(norm(a)^2*norm(b)^2-norm(a.*b)^2)

Add a comment
Know the answer?
Add Answer to:
Matlab Questions (please show what code I need, including any comments, for each of the questions):...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Matlab Questions (please show what code I need, including any comments): You are asked to design...

    Matlab Questions (please show what code I need, including any comments): You are asked to design a water storage tank with a capacity of 1,000 liters. The tank will be fabricated from stainless steel (rolled sheet), which cost $100/ sq. m. You are asked to consider three possible designs for the tank: Option 1 – a cube; Option 2 – a cylinder; Option 3 – a sphere. Calculate the cost of each of these designs and report the least expensive...

  • Use column 2 (8 Kilometer data). Only need "f" and "g" please show work, thank you....

    Use column 2 (8 Kilometer data). Only need "f" and "g" please show work, thank you. Q2. In their paper "The Rewards to running: Prize structure and performance in professional road racing", Lynch and Zaxlook at whether races with large prizes record faster times because they attract faster runners, or because they encourage all runners to run faster (the paper can be found on D2L, but you shouldn't need to read it in order to answer this question) They regress...

  • using matlab to solve this problem as soon as possible thanks use matlab to slove the...

    using matlab to solve this problem as soon as possible thanks use matlab to slove the problem as soon as possible solve the activity of number 1&2&3 by using matlab for this problem i need from you to solve activity one and two and three by using matlab DIRECTIONS: Perform the following using MATLAB. After the simulation, your report must be uploaded in the Moodle Learning system. ACTIVITY I. VECTORS AND ITS OPERATIONS Procedure 1: Define two vectors a and...

  • I need help solving these questions,please don’t know how to solve it by using matlab.!

    i need help solving these questions,please don’t know how to solve it by using matlab.! Solve the following questions Ol: You are required to develop a script to calculate the volume of a pyramid, which is 1/3 *base *height, where the base is length *width. Prompt the user to enter values for the length, width, and height, and then calculate the volume of the pyramid. When the user enters each value, he or she will then also be prompted to...

  • These questions are to be answered using MATLAB. I only need #3 answered, but #1 provides...

    These questions are to be answered using MATLAB. I only need #3 answered, but #1 provides information (like initial velocity, etc.) required for the questions. I think I have it done, but I'd like to see if there are other ways to use MATLAB for this question. PROJECTILES The distance a projectile travels when fired at an angle 8 is a function of time and can be divided into horizontal and vertical distances. Horizontal (1) = 1.V.cos(0) Vertical(t) = 1•...

  • I need help with the matlab code, thank you. The purpose of this assignment is to...

    I need help with the matlab code, thank you. The purpose of this assignment is to illustrate one important difference between linear and nonlinear models of oscillating systems. In an undamped, unforced linear system, the period of a periodic solution depends only on system parameters and not on the initial conditions, but in a nonlinear system the period can depend on the initial conditions Consider the following nonlinear differential equation, which models the free, undamped motion of a block attached...

  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks.please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me...

  • matlab 1. [suDmit as Iwo JPEGS in Canvas with your netiD in the title of each...

    matlab 1. [suDmit as Iwo JPEGS in Canvas with your netiD in the title of each plot] An electricity startup is looking into the viability of putting solar panels on the rooftops of buildings in Newark, NJ. They want you to help them come up with visualizations for data they have from the National Renewable Energy Laboratory and the National Oceanic and Atmospheric Administration about: - The average amount of sunshine received each month in the form of Global Horizonal...

  • Please, I need help with program c++. This is a chutes and ladders program. The code...

    Please, I need help with program c++. This is a chutes and ladders program. The code must be a novel code to the specifications of the problem statement. Thank you very much. Assignment Overview This program will implement a variation of the game “chutes and ladders” or “snakes and ladders:” https://en.wikipedia.org/wiki/Snakes_and_Ladders#Gameplay. Just like in the original game, landing on certain squares will jump the player ahead or behind. In this case, you are trying to reach to bottom of the...

  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in Matlab and show me the code. Thanks. Problem #1: Circuits and linear-systems In the last HW you developed the governing equations for the “Wheatstone”-bridge circuit used extensively in engineering applications (shown below). B R R2 A D G m RA с E The resulting equations were solved for the output voltage and currents using the function: function [V_out, I_vector] =Wheatstone_bridge (v_in, R_vector) In...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT