Docsity

CMPSC 200 FINAL EXAM VERIFIED STUDY GUIDE, Exams of Social Sciences

Toggle sidebar
bg1
CMPSC 200 FINAL EXAM VERIFIED STUDY GUIDE
MATLAB name meaning - Answers - "MATrix LABoratory"
Meshgrid - Answers - Function that facilitates calculations with two variables that are
row arrays by creating two 2-dimensional arrays that can be used for the operation.
Format of a function .m file - Answers - function [ result ] = functionname( variable
inputs)
% description of function
% input, output, processing steps
calculations
result = ;
end
disp - Answers - function that may be used to output value(s) stored in an array. Can
only combine text and numbers if you cnovert one to the other.
Not much control over the format.
num2str(a) - Answers - converts number to string so as to display both together in a
single display
fprintf - Answers - Formatted Output - function that allows more control over the
display of an output.
general format: fprint(text with placeholders %f, variables)
ginput - Answers - function that allows users to extract information from a graph
ginput(n) specifies how many points (n) can be extracted from the graph
uiimport - Answers - opens the import wizard
xlsread - Answers - reads data from an excel file
xlswrite - Answers - writes files for use in excel
3 types of control structures - Answers - Sequence, Selection, and Repetition
Relational Operators - Answers - < less than
<= less than or equal to
> greater than
pf3
pf4
pf5

Partial preview of the text

Download CMPSC 200 FINAL EXAM VERIFIED STUDY GUIDE and more Exams Social Sciences in PDF only on Docsity!

CMPSC 200 FINAL EXAM VERIFIED STUDY GUIDE

MATLAB name meaning - Answers - "MATrix LABoratory" Meshgrid - Answers - Function that facilitates calculations with two variables that are row arrays by creating two 2-dimensional arrays that can be used for the operation. Format of a function .m file - Answers - function [ result ] = functionname( variable inputs) % description of function % input, output, processing steps calculations result = ; end disp - Answers - function that may be used to output value(s) stored in an array. Can only combine text and numbers if you cnovert one to the other. Not much control over the format. num2str(a) - Answers - converts number to string so as to display both together in a single display fprintf - Answers - Formatted Output - function that allows more control over the display of an output. general format: fprint(text with placeholders %f, variables) ginput - Answers - function that allows users to extract information from a graph ginput(n) specifies how many points (n) can be extracted from the graph uiimport - Answers - opens the import wizard xlsread - Answers - reads data from an excel file xlswrite - Answers - writes files for use in excel 3 types of control structures - Answers - Sequence, Selection, and Repetition Relational Operators - Answers - < less than <= less than or equal to > greater than

>= greater than or equal to ~= not equal to == equal to Logical Operators - Answers - | or, if either condition is true, the combination is true & and, if both conditions are true, the combination is true ~ not, reverses the truth of the condition xor if one of the conditions is true, but not both, the combination is true | or truth table - Answers - Cond1 | Cond2 Result T T T T F T F T T F F F & and truth table - Answers - Cond1 & Cond2 Result T T T T F F F T F F F T xor xor truth table - Answers - Cond1 xor Cond2 Result T T F T F T F T T F F F Logical Functions - Answers - Find, All, Any find - Answers - returns the index of the elements of the array that meet the condition all - Answers - returns true if all the elements of the array meets the condition, otherwise returns false any - Answers - returns true if any of the elements of the array meet the condition, otherwise returns false Sequence Structure - Answers - commands are executed one right after another in the exact order they are written Selection Structure - Answers - one sec of commands is executed when a condition is true and another set if the condition is false Repetition Structure - Answers - set of commands that are issued over an over again (loops) "If" Selection Structure - Answers - if (condition) statements to be executed if true elseif (condition) statements to be executed if condition2 is true

require less space than floating point numbers interpolation - Answers - used to estimate the y value for an x value that was not measured, as long as the x is within the known range linear interpolation - Answers - interp1(x,y, new_x) interp1(x,y,new_x, 1) interp1(x,y,new_x, 'linear') multidimensional interpolation - Answers - interp2 and interp3 functions can interpolate in 2 and 3 dimensions, respectively polyfit - Answers - function that will return the coefficients of various orders of polynomials polyfit(x,y, n) where n is the order of the polynomials polyval - Answers - function that takes the coefficients from the polyfit function and the x values to calculate possible y values y_new = polyval(coeff,x) diff - Answers - function that takes the derivative if a logical input or the difference in values of an array of numerical data quad - Answers - function that uses simpson's quadrature to estimate the area of a function handle and two points quadl - Answers - function that uses lobatto's quadrature to estimate the area given a function handle and two points Bracketing Methods to find Roots - Answers - Incremental, Bisection, False Position need two guesses that bracket a root Slow, but usually work Open Methods to find Roots - Answers - Newton Raphson and Secant Method Need one or more guesses Fast, but do not always work Incremental method to find root - Answers - Move from first guess to second in a series of steps, find positions were the result of function changes sign Bisection method to find root - Answers - evaluate function at midpoint between two guesses. if evaluation =0, then done. if first guess and midpoint have same sign, then repeat with midpoint and second guess. Otherwise repeat with first guess and midpoint. False Position method to find root - Answers - (linear interpolation)

draw straight line between two guesses, evaluate at y=0, repeat with guess tha thas opposite sign as possibility imagesc - Answers - the scale image function uses the entire colormap to represent the data