Podcast
Questions and Answers
What is the maximum number of characters allowed for a variable name in MATLAB for this class?
What is the maximum number of characters allowed for a variable name in MATLAB for this class?
What will 'ans' represent if no variable is specified in a MATLAB operation?
What will 'ans' represent if no variable is specified in a MATLAB operation?
Which command will display the value of pi with 16 digits?
Which command will display the value of pi with 16 digits?
How is a row vector defined in MATLAB?
How is a row vector defined in MATLAB?
Signup and view all the answers
Which of the following is NOT a reserved variable in MATLAB?
Which of the following is NOT a reserved variable in MATLAB?
Signup and view all the answers
What type of format should you leave when dealing with complex numbers in MATLAB?
What type of format should you leave when dealing with complex numbers in MATLAB?
Signup and view all the answers
How would you create a 3x3 matrix in MATLAB?
How would you create a 3x3 matrix in MATLAB?
Signup and view all the answers
What is the correct MATLAB command to calculate the sine of 45 degrees?
What is the correct MATLAB command to calculate the sine of 45 degrees?
Signup and view all the answers
What is one of the intended learning outcomes of the course?
What is one of the intended learning outcomes of the course?
Signup and view all the answers
Which of the following best describes the progression of teaching qualities mentioned?
Which of the following best describes the progression of teaching qualities mentioned?
Signup and view all the answers
What type of graphical presentations will students learn to generate?
What type of graphical presentations will students learn to generate?
Signup and view all the answers
How will students manage data within Matlab during the course?
How will students manage data within Matlab during the course?
Signup and view all the answers
What type of control structures will be covered in the course?
What type of control structures will be covered in the course?
Signup and view all the answers
According to the course outline, which aspect of Matlab will students NOT learn about?
According to the course outline, which aspect of Matlab will students NOT learn about?
Signup and view all the answers
What does the quote by Martin Luther King Jr. suggest about progress?
What does the quote by Martin Luther King Jr. suggest about progress?
Signup and view all the answers
What is emphasized as the role of a great teacher in the quotes provided?
What is emphasized as the role of a great teacher in the quotes provided?
Signup and view all the answers
What is the correct syntax for plotting multiple functions in MATLAB?
What is the correct syntax for plotting multiple functions in MATLAB?
Signup and view all the answers
Which of the following defines the range of 'x' in the first example provided?
Which of the following defines the range of 'x' in the first example provided?
Signup and view all the answers
In the context of the example plot with sine and cosine functions, what command is used to add a legend?
In the context of the example plot with sine and cosine functions, what command is used to add a legend?
Signup and view all the answers
What is the title of the plot in Example_plot4?
What is the title of the plot in Example_plot4?
Signup and view all the answers
Which line of code modifies the appearance of the plot with line style, color, marker size, and edge colors?
Which line of code modifies the appearance of the plot with line style, color, marker size, and edge colors?
Signup and view all the answers
What does the size(F)
command return when F is a matrix created with ones(1,3)
?
What does the size(F)
command return when F is a matrix created with ones(1,3)
?
Signup and view all the answers
What result is produced by the command A.^2
if A is defined as A = [1 2 3; 4 5 6; 7 8 9]
?
What result is produced by the command A.^2
if A is defined as A = [1 2 3; 4 5 6; 7 8 9]
?
Signup and view all the answers
What does the command tril(A)
return when A is a matrix?
What does the command tril(A)
return when A is a matrix?
Signup and view all the answers
What is the effect of the command A(:,3)
when A is a defined matrix?
What is the effect of the command A(:,3)
when A is a defined matrix?
Signup and view all the answers
Which command would you use to obtain the diagonal elements of matrix A?
Which command would you use to obtain the diagonal elements of matrix A?
Signup and view all the answers
What is the outcome of x = A
when solving a system of linear equations?
What is the outcome of x = A
when solving a system of linear equations?
Signup and view all the answers
How is matrix A augmented with identity matrix I in the command Aug=[A I]
?
How is matrix A augmented with identity matrix I in the command Aug=[A I]
?
Signup and view all the answers
What does the command inv(A)
compute?
What does the command inv(A)
compute?
Signup and view all the answers
Which MATLAB command is used for creating a log/log plot?
Which MATLAB command is used for creating a log/log plot?
Signup and view all the answers
What is the range of x when plotting the function f(x) = x^4 + √30x - 1 using fplot?
What is the range of x when plotting the function f(x) = x^4 + √30x - 1 using fplot?
Signup and view all the answers
What does the command 'axis([0 pi 0 1])' control in a plot?
What does the command 'axis([0 pi 0 1])' control in a plot?
Signup and view all the answers
Which of the following statements is true about the semilogx function?
Which of the following statements is true about the semilogx function?
Signup and view all the answers
What is the output of the command 'grid on' in a MATLAB plot?
What is the output of the command 'grid on' in a MATLAB plot?
Signup and view all the answers
What type of plot does the command 'semilogy(x,y)' generate?
What type of plot does the command 'semilogy(x,y)' generate?
Signup and view all the answers
What is a primary feature of the 'fplot' function in MATLAB?
What is a primary feature of the 'fplot' function in MATLAB?
Signup and view all the answers
In plotting the polynomial equation f(x) = x^4 + √30x - 1, what does the term '√30x' represent?
In plotting the polynomial equation f(x) = x^4 + √30x - 1, what does the term '√30x' represent?
Signup and view all the answers
What does the command hold on
accomplish in a plotting script?
What does the command hold on
accomplish in a plotting script?
Signup and view all the answers
Which line of code would correctly create two exponential plots on different figures?
Which line of code would correctly create two exponential plots on different figures?
Signup and view all the answers
What purpose does the subplot(m, n, p)
command serve?
What purpose does the subplot(m, n, p)
command serve?
Signup and view all the answers
How can you label the horizontal axis of a plot?
How can you label the horizontal axis of a plot?
Signup and view all the answers
Which of the following commands will create a sine wave plot with circle markers?
Which of the following commands will create a sine wave plot with circle markers?
Signup and view all the answers
What function is used to add a grid to a plot?
What function is used to add a grid to a plot?
Signup and view all the answers
What does the plot(x, y1, 'b')
command do in a plot?
What does the plot(x, y1, 'b')
command do in a plot?
Signup and view all the answers
Which of the following equations best describes y1 in the context of a plotted function?
Which of the following equations best describes y1 in the context of a plotted function?
Signup and view all the answers
Study Notes
Course Information
- Course title: Computer Applications
- Course codes: MSE 360/METE 352, MSE 262/METE 258
- Instructor: Dr. K. Mensah-Darkwa
- Teaching assistant: Miss Nancy Boye Mensah/Miss Christabel Wireko Arthur
- Lesson 01: Introduction
- Lesson 02: Overview of MATLAB
- Lesson 03: Plotting
Course Features
- Presentation
- Tutorials and Class discussions
- In class Quizzes (Every week)
- Assignments
- Attendance
- Assessments
- Mid-Semester
- End of Semester
Class Policy
- Attendance is mandatory and strictly enforced
- Missing class requires a written reason within 2 days
- Quizzes can be announced or unannounced
- Late classwork, homework or assignments are not accepted
Grade Evaluation
- Continuous Assessment (30%)
- Assignments + Quizzes + Group Project (20%)
- Mid-Semester (10%)
- Participation in Class (Bonus)
- End of Semester (70%)
- Section A (40%)
- Section B (60%)
MATLAB
- MATLAB is a high-level language and interactive environment
- Used to perform computationally intensive tasks faster than traditional languages like C, C++, and Fortran.
- Created in the late 1970s by Cleve Moler
- Developed by Mathworks, Inc.
- Access MATLAB from the desktop or startup menu. Avoid multiple clicks.
- MATLAB file extensions: -.m (function, script) -.txt (user-generated text file) -.fig (figure) -.mat (binary file for storing variables)
MATLAB File Extensions
- .m (MATLAB function, script)
- .txt (MATLAB user-generated text file)
- .fig (MATLAB figure)
- .mat (MATLAB binary file for storing variables)
MATLAB Commands
- clc: Clears the command window
- clear: Clears all current variables
- who: Lists the variables
- whos: Lists variables, size, and type
- format long: Displays 16 numerical digits
- format bank: Displays the number in banking format
- Common mathematical functions:
exp
,sqrt
,log
,log10
,abs
,angle
,conj
,imag
,real
,ceil
,fix
,floor
,round
,sign
- Operator precedence follows PEMDAS (Parentheses, Exponents, Multiplication and Division, Addition and Subtraction).
- Using MATLAB for matrix manipulations: Creation, operations, element-by-element operations, matrix inversion, left division.
- Functions for matrices:
zeros
,ones
,eye
,rand
,size
,tril
,triu
,diag
,inv
,det
.
MATLAB Variables
- Variable names must start with a letter and can contain numbers or underscores.
- Avoid using MATLAB reserved variables like
ans
,eps
,i
,j
,Inf
,NaN
,pi
MATLAB Functions
-
fzero
: finds the root of a single equation -
roots
: finds all roots of a polynomial equation -
lu
: LU factorization of a matrix -
chol
: Cholesky factorization of a matrix
MATLAB Plotting
- Simple plotting:
plot(x,y)
- Creating plot using data in x and y vectors
- Multiple plotting:
plot(x,y, x,z)
- Plotting options:
plot(t,v,'--dc','LineWidth',2,...'MarkerSize',10,...'MarkerEdgeColor','k',... 'MarkerFaceColor','m')
,title('Plot title')
,xlabel('x-axis label')
,ylabel('y-axis label')
,grid on
- Subplots:
subplot(m,n,p)
, where m is rows, n is columns and p is plot position. - 3D Plotting;
plot3(x,y.z)
,mesh(x,y,z)
,surf(x,y,z)
MATLAB Programming
- Script files are simply sequences of MATLAB commands
- Function files start with the word
function
-Can accept input and return outputs - Structure Programming
- Conditional statements (
if
,elseif
,else
,end
) - Loops (
for
,while
,end
,break
)
- Conditional statements (
- Logical Operators - logical expressions (
&
,|
,~
) - Input and output
-Input: prompts the user for a value
input
-Output:disp(string)
,fprintf(format string)
,
Group work information
- Group 9
- Group project topic: mse2
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your knowledge on the basics of MATLAB with this quiz designed for 10th class students. You'll answer questions about variable names, vectors, commands, and more, helping reinforce your understanding of MATLAB. Perfect for anyone looking to enhance their programming skills in this essential software for technical fields.