• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/15

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

15 Cards in this Set

  • Front
  • Back
else cannot _______

the else is only needed if__________
check a condition…knows last condition is false

there are statements to execute is condition is false.
___________ key will interrupt (stop) a MatLab code that is running.
Holding the <Ctrl> key while you press the <c>
Use_______to realign statements in code
>Text>Smart Indent
When do you use Nested ifs?
Used when you need to check a second condition only if the first condition is true.
When do you use else ifs?
Used when you need to check a second condition if the first condition is false.
logical “1” = true “0” = false

& AND x > 4.0 & x < 8.0 ( 4.0<=x<8.0)
returns a logical “1” when both
conditions are true and “0” otherwise
logical “1” = true “0” = false

| OR x < 6.0 | x > 12.0
returns a logical “1” if either or both conditions are true and “0” otherwise
logical “1” = true “0” = false

~ NOT ~ ( x > 0.0)
returns a logical “1” when the condition evaluates as false and a “0” when the condition evaluates as true
We used stacked ifs:
To determine the units on the temperature entered first
To determine if TF = TC. but
To check if TF is greater than, equal to, or less than TC we can’t just add more stacked ifs, we need to use a nested or elseif structure.
Using elseif:

if abs(Tcomp-TC)<=0.05
fprintf(‘TF=TC’)
elseif Tcomp>TC
fprintf(‘TF>TC’)
else
fprintf(‘TF<TC’)
end
When are stacked ifs used?
Stacked if structures are used when decisions are independent of each other
When are Nested ifs/elseif used?
Nested if (and elseif) structures are used when a dependency between the conditions can be identified.
The elseif structure works especially well for sorting.
What are Uses for repetition structures?
-Repeating a calculation for a number of values
-Accessing elements of a vector/matrix in turn
-Incrementing a value (counting)
-Computing the sum of a user specified number of values entered one at a time
-Creating a table
What do you use for the repetition loop?
Repetition using the for loop
J = 1:1:10
what does each thingi stand for?
J = control variable
1 = initial value
1 = increment
10 = number of times program should be run
This controls the number of repetitions of the loop.
For Loop Examples
- User control of Start, Step, and Stop values
- Creating a table
- Creating/storing and Using Vectors
- Calculating an average (summing entered values)
- Plotting point by point