- Details
- Parent Category: Engineering Assignments' Solutions
We Helped With This Mechanical Engineering Homework: Have A Similar One?

Category | Engineering |
---|---|
Subject | Mechanical Engineering |
Difficulty | College |
Status | Solved |
More Info | Bending Moment Mechanical Engineering Homework Help |
Assignment Description
Spring 2018 Matlab Project
The Matlab project will comprise two parts.
Let the user draw and close a figure
Set up a blank figure where the user can click to enter points to create a closed figure. Set the axes to go from 0 to 100 along the x-axis and make sure the axis scaling is equal. Make sure that that scaling is maintained throughout the process. You may find axisvec = axis; call to be useful in finding the scaling after it is initially set, then axis(axisvec); to reset it to that after each change is made to the figure.
Draw a new line segment or finish and close the figure. Prompt the user to either left-click to add a point to the figure or right-click to finish. As the user clicks on each point, record its location in a list. Put a circle marker at the point clicked and draw a line to connect the last point to the point clicked before it, drawing a figure as the points are clicked. The user can create a figure with as many points as he chooses. When he is done, he right clicks anywhere on the figure to end the process and the last point is connected to the first to close the figure. As each point is clicked, echo its (x, y) coordinates to the console.
Use a loop to calculate the area of the closed figure
There are easy ways to do this with a list of coordinates of a polygon. One with a description and example of the process is at wikihow. Do this using a loop, with any additional code needed to handle the first or last points, as needed. Note that figures drawn in the opposite direction assumed in a particular method may result in negative areas. Use that knowledge to determine if the user drew the figure clockwise or counterclockwise.
A sample run is shown:
>> MatlabProject
Left-click on a point for the figure (right-click to quit): (29.839, -0.191)
Left-click on a point for the figure (right-click to quit): (30.069, 20.316)
Left-click on a point for the figure (right-click to quit): (39.747, 20.085)
Left-click on a point for the figure (right-click to quit): (39.977, 29.763)
Left-click on a point for the figure (right-click to quit): (69.700, 0.039)
Left-click on a point for the figure (right-click to quit): Quit! The closed polygon has area = 649.488 and was drawn clockwise.
>>