Matlab Flashcards

1
Q

When can the && and || be used. What’s the difference between their functions on scalar and array.

A

the && and || cannot be used for arrays. For scalars, using the double instead of the single makes it so if one condition is met, the code is short-circuited.

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

Define Cell arrays. What makes them different form the normal kind of arrays and how do you calculate them. And how do you index them.

A

Cell arrays can stack different kinds of data type in them. Etc, string and double integers can be put together. You use curly bracktets { } to create cell arrays. Using standard brackets will return the cell itself. But if you use { } the contents of the array will be returned.

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

What’s the difference between break and continue in loops.

A

The Break function jumps out of the entire loop when a condition is met. The continue function jumps back to the start of the loop.

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

Why use UDF ? And what’s the long form of that bro?

A

UDF - User defined Functions are used for better readability, portability and and reliability.

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

What is the purpose of and the difference between local and global variables?

A

When using UDF, a locak variable will be created within the function but will not appear on the workspace, but If you want to use the variables that are created within these UDF, you will need to declare them global by typing them both in the UDF and the main window.

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

What is ezplot? what is it’s function ? What can you use the hold function as ?

A

ezplot is the symbolic equivalent of the plot function. As such, there are also functions such as ezsurf, ezmesh etc. They will always plot within the range -2pi and 2pi if no range is specified. To plot more than one plot, you can use hold.

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

What is simulink and what is it used for ?

A

Simulink allows users to create a mathematical model and run it for a specific length of time. It can deal well with systems that can be modelled as
differential equations, solving them numerically.
• It is used extensively in research and industry as it can
integrate into hardware to perform hardware-in-the-loop testing.

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

What is the difference between clear and clc.

A

Clc clears the command window. Clear clears away all the variables in the workspace.

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