TDDD34 Programming with Applications in Engineering Statements
in Matlab To write any programs of interest you will need to
know the most basic set of statements and expressions and
operators available in Matlab. This is a list of what you need
for the course: Input and output (user interaction) disp('some
text') Displays "some text" on the screen. disp(variable)
Displays the variables value. disp(['Sum = ' num2str(x)])
Displays the text "Sum = " followed by the content of the
variable x (x is an integer number). Notice the necessary
brackets. x = input('enter a number') Displays the text "enter a
number" and waits for the user to enter something that can be
assigned to the variable x. x The content of the variable x is
displayed. OBS! Only use to trace the execution when you try to
localize errors. Use disp(x) by default. format Change how
numbers are displayed (format, number of digits etc.).
Assignment to a variable variable = expression The expression
can be a constant or a calculation. The result is stor