Presentation is loading. Please wait.

Presentation is loading. Please wait.

Final Exam Review Part 2 - MATLAB

Similar presentations


Presentation on theme: "Final Exam Review Part 2 - MATLAB"— Presentation transcript:

1 Final Exam Review Part 2 - MATLAB
ChE 160 SI – Becca Fall 2016

2 What are you concerned about?
MATLAB What do you remember? What are you concerned about?

3 Basics What do these commands or notations do? clc clear % ; \n

4 Basics- Answers clc - clears command window clear - clears workspace
% - makes a comment ; - suppresses values from showing in command window \n – return to the next line (like hitting enter)

5 Vectors Fill in where the starting and ending values go and step size/number of places in the vector. Spring_vector = _______:_______:_______ ; Spring_vector2 = linspace(_______,________,________);

6 Vectors- Answers Spring_vector = starting value : step size : end value ; Spring_vector2 = linspace(start, end, number points)

7 Assorted How do you transpose/flip a vector or matrix?
What does the function input( ) do? How do you use fprintf( )?

8 Assorted- Answers Single apostrophe transposes
column_vector = row_vector’ ; input( ) allows the user to put in a value from the command window Candy_Hearts = input(‘How many candy hearts do you eat each Valentine’s Day?’) ; fprintf( ) displays text and numbers into the command window from script fprintf(‘You eat %g candy hearts each Valentine’s Day. \n’, Candy_Hearts)

9 Graphing How do you plot 2 sets arrays of data?
What is the difference between plot(), semilogy(), and loglog() How do you use ‘MarkerFaceColor’? What is the letter for a line, circle, and triangle? What is the letter for black, magenta, blue, green, and red?

10 Graphing- Answers How do you plot 2 sets arrays of data? plot(a,b)
What is the difference between plot(), semilogy(), and loglog() Rectangular, semilog with y log scale, log-log plot How do you use ‘MarkerFaceColor’? Change color of the marker face in a plot to fill What is the letter for a line, circle, and triangle? ‘-’ ‘o’ ‘^’ What is the letter for black, magenta, blue, green, and red? ‘k’ ‘m’ ‘b’ ‘g’ ‘r’

11 Polyfit/Polyval Why do you use polyfit and polyval?
What does polyfit find? What does polyval find? Fill in the blanks: __ = polyfit(_____,______,_____); __ = polyval(______,______);

12 Polyfit/Polyval- Answers
Why do you use polyfit and polyval? Fitted line for the data, linear regression for Matlab What does polyfit find? Polynomial coefficients, m slope and b intercept What does polyval find? Fitted dependent values Fill in the blanks: P = polyfit(x,y,[degree of polynomial]); yfit= polyval(P,xfit);

13 What is the basic structure of…
Loops What is the basic structure of… For loop If Loop While Loop

14 for (counting statement) calculations and statements end
For Loops- Answers for (counting statement) calculations and statements end

15 If Loops- Answers if (conditional statement) calculation/statement elseif (conditional statement) else final option end

16 While Loops- Answers %Initialize value while (conditional statement) calculations end

17 Loops What is the difference between the structure of a for and while loop? How can you use nested for loops to create matrix?

18 Loops- Answers What is the difference between the structure of a for and while loop? For iterates a certain number of times, while does it until a condition is met, unknown number of iterations How can you use nested for loops to create matrix? Matricx(r,c) = 3*r-c;

19 Matrices [A][x] = [b] [x] = [A]\[b]

20 Functions Function [Outputvariable] = FunctionName(inputvariable) Calculations Outputvariable = calculation

21 How did that go?


Download ppt "Final Exam Review Part 2 - MATLAB"

Similar presentations


Ads by Google