Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ENGR 6 Matlab Coding Assignment 2 : Vectors & Scripts w . IO Solve the following problems using Matlab. Cut and paste the code and

ENGR 6
Matlab
Coding Assignment 2: Vectors & Scripts w. IO
Solve the following problems using Matlab. Cut and paste the code and results into Word. Problems 1 through 3 are short answer and can be done in the command window. Problems 2-4 & 2-5 require you to make scripts with complete documentation and descriptive variables.
2-1 Use the start:step-size:end method to create a vector x having 35 linearly spaced values starting at 12 and ending at 40. The challenge is to get the correct step size. Check using linspace and make sure they match. You only need to show the first few and last few elements in the vector.
2-2 Create a vector Y having 20 logarithmically spaced values starting at 10 and ending at 1000. The default display of vectors of large numbers uses scientific notation at the top/front of the list. Double check your results, if you see Inf you've made a mistake.
2-3 The scalar triple product computes the magnitude M of the moment of a force vector F about a specified axis. It is M=(rxF)*(nnorm(n)). The axis vector n is divided by its magnitude using the norm function to create the unit vector pointing in the same direction as the n axis. r is a position vector connecting the axis to the point of application of the force. x is the cross product operation and - is the dot product operation. Use MATLAB to compute the magnitude M for the case when F=[12,-5,4]N,r=[-3,5,2]m, and n=[6,5,-7]m. You will use norm , and cross functions.
Problems 2-4 & 2-5 require you to make scripts with complete documentation and descriptive variable names. Cut and paste the code from the program editor into your Word document. You must also show the results of executing the script. Cut and paste the results from the command window into your Word document.
2-4 The force required to compress a spring relates to the compression distance using Hooke's law: F=kx, where k is the spring constant in Newtons per meter, F is the force in Newtons, and x is the compression distance in the spring in meters. The potential energy stored in the spring is measure with the units of Joules using the equation: E=kx22. The table below gives the data for 5 different springs. Write a Matlab script to store the Force and Spring Constant data in the workspace, Compute the compression distance in each spring (as a vector). Compute the potential energy in each spring (as a vector). Report your answers using fprintf with auto repeat so they show up in two rows, similar to the input table below.
\table[[Force values (N):,11,7,8,10,9],[Spring Constants (N/m):,1000,600,900,1300,700]]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions