Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve using the following format! I keep getting stuck. It would be greatly appreciated! function project_9_() % PROJECT_10_ project_10_() is the driver function for

Please solve using the following format! I keep getting stuck. It would be greatly appreciated! image text in transcribed

function project_9_() % PROJECT_10_ project_10_() is the driver function for the program. % % Name: % Date: 30 March 2017 % Class: CMPSC 200 % Description: Determine the location to achieve minimum tension % % Print the splash screen programmersName = ''; programDate = '6 April 2017'; programDescription = ''; % Print splash screen % Get Inputs [lengthBeam lengthCable weight] = getData(); % Calculate the vector of tensions, minimum tension, and location [tension d minTension minLocation] = tensionInCable(lengthBeam, lengthCable, weight); % Print results in a function % Plot a graph of the tension as a function of the location plotResults(tension, d, minTension, minLocation); end function [lB lC w] = getData() % GETDATA [lB lC w] = getData() is a wrapper function that puts all fo the % input calls into a single function that can be called from the driver % % Name: % Date: % Class: CMPSC 200 % Revised: % % end function [lB] = getBeamLength() % GETBEAMLENGTH [lB] = getBeamLength() is a function that will prompt the % user to enter the length of the beam while providing the necessary checks % on the user's input. It uses the isInRange function to check if the value

% entered is within some pre-determined set of bounds. This is a recursive

% function in checking the bounds.

%

% Name: Prof. % Date: 30 March 2017 % Class: CMPSC 200 % Revised: %

%

% Set the min and max values minX = 0; maxX = inf;

% Prompt the user prompt = 'Enter the length of the beam';

% Enter the value lB = input(prompt);

% Check if input is within range - use isInRange

% where isInRange returns 0 or 1 validInput = isInRange(x, minX, maxX);

% If out of range give a warning message. if(~validInput) warning('Entered value is not within the proper range.');

% Call the input function again lB = getBeamLength(); end end function tf = isInRange(x, minval, maxval)

% ISINRANGE isInRange(x, minVal, maxval) is function to check if the value

% passed is between the given limits. This function uses nargin to determine

% if the check should be done at all (nargin == 1), if it should only check

% the lower bound (nargin == 2), or if it should check both bounds (nargin % == 3)

%

% The function returns a boolean result (0 or 1) depending on the results

% % Name: Prof. % Date: 3 March 2016 % Class: CMPSC 200 % %

% Use nargin to overload the function if nargin == 1

% There are no bounds everything is true s = 1; t = 1; elseif nargin == 2

% Check only the lower bound s = (x >= minval); t = 1; elseif nargin == 3

% Check both lower and upper bounds % Check the lower bound s = (x >= minval);

% Check the upper bound t = (x

end

% If both are true then x is in range tf = s .* t; end function plotResults(tension, d, minTension, minLocation)

% PLOTRESULTS plotResults(tension, d, minTension, minLocation) is a

% function to create a plot of the tension in the cable as a function

% of the distance across the beam. It should also add a marker at the

% point on the curve where the tension is a minimum. % % The plot should also include appropriate labels for the axies, scaling, % and a title. % % Name: % Date: % Class: CMPSC 200 % %

end

A cable of length Lo supports a beam of length Lb so that it is horizontal when the weight W is attached at the beam end. The principles of stat- ics can be used to show that the tension force T D in the cable is given by bLc D L2 D2 where D is the distance of the cable attachment point to the beam pivot. Write a Mat Lab program that uses element wise operations and the min function to compute the value of D that minimizes the tension T. Note: Do Not Use a Loop. Check the sensitivity of the solution by plotting T versus D. Have the user enter the length of the beam, Lb, the length of the cable, Lc, and the weight, W. These are scalar values. You must use the appropriate error checking on the inputs. In this case, all of the parameters must be greater than zero Use the appropriate techniques for a formal program. This means top-down program de sign. It also means there should be no inputs or printing in calculation functions. All data entry and information output must be in their own functions

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions