ENG1060 Lecture Notes - Lecture 1: Matlab, Nan, Conjugate Transpose

199 views2 pages
Department
Course
Professor
M-files (aka$script$files)
Used$because$command$window$doesn't$save$ur$sequence$of$commands
Shown$in$'Editor'$window$as$tabs
Benefi+s
Can$make$easy$changes$to$code
No$need$to$rewrite
Easy$to$run$top$to$bottom (click$'Run')
*At$top,
clear all; >>>$clears$all$vars$in$workspace
close all; >>>$closes$all$figure$windows
clc; >>>$clears$ command$window
Don't$do$in$function$file,$only$main$script$file
Variables
Must$start$with$a$letter,$numbers$can$be$
afterwards
NO$special/foreign$
characters/spaces
*_$ok$as$long$as$not$first$character
Case-sensitive
Operator3precedence
1.$Parentheses$()$
2.$Transpose$(.'),$power$(.^),$complex$conjugate$transpose$('),$matrix$
power$(^)$
3.$Unary$plus$(+),$unary$minus$(-),$logical$negation$(~)$
4.$Multiplication$(.*),$right$division$(./),$left$division$(.\),$matrix$
multiplication$(*),$matrix$right$division$(/),$matrix$left$division$(\)$
5.$Addition$(+),$subtraction$(-)$
6.$Colon$operator$(:)$
7.$Less$than$(<=),$greater$than$(>),$greater$than$or$equal$to$(>=),$equal$to$
(==),$not$equal$to$(~=)$
8.$Element-wise$AND$(&)$
9.$Element-wise$OR$(|)$
10.$Short-circuit$AND$(&&)$
11.$Short-circuit$OR$(||)
Current$folder
1.
Command$window
2.
Workspace
3.
Help
4.
Built-in3functions
sqrt, mod, rem
log(x) >>>$natural$logarithm$of$x;$log10(x),$exp(x)
sin, cos, tan
round, ceil, floor
min, max, sign
Also$has$imaginary$numbers,$Euler's$number,$infinity,$pi,$NaN$etc
sum -default$down column.
Useful3commands
clc; >>>$$clears$command$window
clear all; >>>$clears$all$vars$in$workspace
close all; >>>$closes$all$figure$windows
fclose all; >>>$$closes$all$files$opened$by$MATLAB
who >>>$ lists$variables,$not$values
whos >>>$name,$size$(of$matrix),$bytes,$class,$attributes$of$each$variable
dir >>>$ gives$folder$you$are$currently$in
help <functn name>
doc <functn name>
help elfun >>>$lists$some$elementary$functns$MATLAB$can$do
A = input('text') >>>$prints$out$text$string$and$awaits$user$input$to$store$
in$A
pause >>>$ pauses$the$m-file$until$a$key$is$pressed
pause(N) >>>$pauses$for$N$seconds
disp(X) >>>$ displays$the$value$of$variable$X
disp('text') >>>$displays$text$string
echo on/off >>>$prints$commands$for$debugging$purposes
Useful3keyboard3shortcuts
TAB$>>>$shows$a$list$of$similar$commands
Week$1
Saturday,$22$July$2017
14:17
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents