MATLAB two-dimensional matrix, plotting) DUE: May 4, 2017 by 11:59 p.m. CT (Fina
ID: 3833761 • Letter: M
Question
MATLAB two-dimensional matrix, plotting) DUE: May 4, 2017 by 11:59 p.m. CT (Final Deadline POINTS: 30 INTRODUCTION: A 0.0254 m diameter pipe is to span a 25 m section of a river while submerged in the river. Flow of the river past the pipe will create a drag force on the pipe. A structural analysis of the pipe indicates that it can withstand a maximum force of 175 N. It is unclear what the velocity of the river is, and a table ofriver velocities is available in the data file river. The drag force on the pipe is given by where p is the density of the water (1000 kg/m3), Vis the average velocity of the water (m/s), and CD is given by the following correlation: 0.681 Pr 1/3 0.193 Re where Pr is the Prandtl number (14.0) for water and Re is the Reynolds number pDV Re Dis the pipe diameter and u is viscosi the of water (0.002 kg ASSIGNMENT: 1. Import the table of river velocities as a one-dimensional matrix. 2. Calculate the drag force on the pipe for each river velocity. Store the river velocity and drag force in a two-dimensional matrix (first column river velocity, second column drag force) 3. Plot the drag force vs. the river velocity. Label each axis and give the plot a title. The plot should be a blue curve with stars at the points. 4. For 5 points of extra credit, list the river Welecityies above which the drag force on the pipe is too high. HEADER Your script file should have a three-line header (commented code). The first line should be "Homework 10", the second line should be your name, and the third line (and fourth, if needed) should be a one-sentence description of the program FILE NAME: The naming convention that was used for C programs cannot be used in MATLAB. Before submitting to Blackboard, name your MATLAB program P sn firstname lastname, where sn is your section numberExplanation / Answer
I have designed the matlab code for building up the Two dimensional matrix which uses the River velocities table along with the comments for the each part of the program.
Program:
% Homework 10
% Chegg Expert
% applying the two-dimensional plotting to the river velocities table
function P10_sn_firstname_lastname(arr)
arr.riverVelocityTableCustomizer.getTableConvertToCustomInfoFcnHandle{end+1} = ...
@riverVelocitiesTable;
end
% Returns the function riverVelocitiesTable
function plotInform = riverVelocitiesTable(blk,tableStr)
plotInform.allowTableConvertLocal = true;
plotInform.tableWorkSpaceVarName = 'table_river_velocity';
plotInform.tableConvertFcnHandle = @myConvertTableFcn;
end
% Uses the convertTable method for better result
function velocityMapping = myConvertTableFcn(velData)
riverValue = size(velData);
riverColumnValue = riverValue(2);
riverRowValue = riverValue(1)*riverValue(3);
velocityMapping = zeros(riverRowValue, riverColumnValue);
velocityMapping = reshape(velData,[riverRowValue,riverColumnValue]);
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.