lesson 1 Flashcards

(19 cards)

1
Q

What does load do

A

load your previously saved variables from saved files into the current workspace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does clear do

A

clear all variables in the workspace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

clc

A

clear all code in the command window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

save

A

save your variables in the workspace into a file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what are the rules when creating a variable

A
  • need to start with a letter
  • can only have letters, numbers and underscores
  • capitals matter
  • cant have more then 63 characters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what does the ; and , do

when writing matrices what does ; do

A

when assigning variables placing a ; at the end of the line does not let the variable eco back in the command within the window
; or , can allow you to assign two variables in one line of code e.g
x = 42, y = 87; (this will both not eco back and assign 2 variable in one line of code)

although if you use , like in example 42 will eco back

; signifies the end of a row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what does … do

A

allows you to continue with you line of code but on the next line down
e.g
r = u
y
and it would give u
y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

errors

A

syntax is an error in the form e.g 1=x (need to have a variable on the left hand side)

semantics is an error in the meaning (the code wont catch this one immediately like a syntax error)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how can you find out what a command does easily within the command window

A

you can type help and then the name of the command, this will pop up with the command and all adjacent commands and what they do

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what does the function length give you?

(Graphs)

A

it gives you the number of elements in a function (when dealing with plotted graphs)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

when plotting a graph what does ‘*’ do

A

it replaces the standard line graph with a * to represent each point plotted like a scatter graph (lines are not connected like a line graph)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what does ‘ ‘ do?

for example when plotting graphs you can use this for…

A

this tells MATLAB not to treat those characters as the name of an operation, variable or function. instead it treats the characters between the quotes as just a string of characters called a - string

changing the things about the graph e.g coulor of line, shape of plot points ect
e.g
»plot(x_cordinate, y_cordinate, ‘rsquare’) is red square points
or shortened as:
» plot(x_cordinate, y_cordinate, ‘rs’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

how to label a graph…

A

xlabel(‘example’}
ylabel(‘example’)
title(‘example’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

how to manually set what axis are displayed

how to get rid of axis

A

> > axis([0, 12, -10,20])
need to explain what brackets are used and that the first coordinates set the the range for the x axis and the second set the range for the y axis

> > axis off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

how do you change the graph to bar chart?

A

bar(X,Y)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

how to get another figure

17
Q

how to close (a) figure(s)

A

> > close 1
or
close 2
ect
or
close all

18
Q

how to stop MATLAB

19
Q

how should you go about viewing a saved image within a file on a figure

A

save the image to a variable
e.g
»pretty_picture = imread(‘palace.JPG’)
the picture is captured in the variable pretty picture
the use the functioan image to veiw whats in teh veriabel
»image(pretty_picture)

imread(‘palace.JPG’) loads the image into matlab but you should always assign it to a variable otherwise the command window will be clogged with all the code for the image