I need to use SI units. Any help would be appreicated. Task 1 In this task, you
ID: 3697557 • Letter: I
Question
I need to use SI units. Any help would be appreicated.
Task 1 In this task, you will write a MATLAB function named plot_forces that solves for the forces in the members in Figure 1 by calling force_sol (see Task 2) over a range of different masses, and plots the results. In this function, you will create the system’s A matrix and factor it into L, U and P using a call to the LU decomposition function that is specified in the second input argument. As such, it must accept two inputs: (1) a range of masses in a vector and (2) a function name or function handle of a function which computes L, U, and P from A. Thus, it must have a definition of the following form: function [h] = plot_forces(m, lu_func)
where the following are input arguments:
• m : A vector of mass values (e.g. m = [0:50:500] kg).
• lu_func : The function name or function handle of the LU decomposition function to use. This function must have the form of [L, U, P] = lu_func(A), which matches the call of the built-in MATLAB function lu.
The output argument is the following:
• h : A figure object handle for the plot produced (see details below). Force versus mass for each member must be plotted on the same set of axes.
Notes: The plot_forces function will (1) form A, (2) compute L, U, and P from A using the function indicated in lu_func, (3) iterate over the vector of masses, producing a new b and a solution of forces in each member for each mass and (4) produce a plot of the forces in each member as a function of mass. Because the plot_forces function takes another function as an input, it is called a “function function.” As such, it must be able to accept the MATLAB built-in function lu. Lastly, your plot_forces must plot the forces for each member on the same set of axes (i.e. the same figure), provide an appropriate title, properly label all axes, differentiate the curves (with style, marker and color) and include a legend to label the curves. Your plot_forces function must return a handle to the figure object.
Explanation / Answer
[php]% Load and display the image:
image = imread('photograph.jpg'); imshow(image);
% Select the outline of the object of interest:
h = impoly(gca,[]);
% Compute area of polygon made by this outline.
% Compute the centroid the polygon.[/php]Here's what I'm trying to figure out:
The "impoly" function in line 4 of the above code allows the user to either copy the xy coordinates of the outline nodes or set the color of the polygon by right clicking in the outlined polygon and selecting an option from the context menu. What I'd like to do is retrieve the coordinates of the nodes without having to select "Copy" from the context menu. This way I'll have the outline of the polygon to compute its area and centroid.