Sholihun, M.Sc.
MATLAB
Command Window: - running program - finding help M-File: a place to create a program - symbolic programming - numerical programming GUI: an interface to make an user-friendly program - usually used to make a simulation
2
Note: we can do all commands above just by using mouse like we usually do, but it is unique if we can use those commands
Other commands: clc : to clear something written in CW clear or clear all : to clear memory recorded syms x y z : to define variables Some functions provided by MATLAB: sinusoidal: sin(x), cos(x), tan(x), sec(x), csc(x),cot(x). Their invers: asin(x), acos(x), etc. Other functions: exp(x), log(x) = ln or natural logaritmic, log10(x) = logaritmic, etc.
3
M.Sc. Physics
Programming Logic
Loop for : Example 1: the constant pi can be approximated by:
Solution:
M.Sc. Physics
To make a program to solve this problem, follow these steps: Firstly, we separate the equation to be positive and negative series: Positive series: Negative series:
M.Sc. Physics
10
11
M.Sc. Physics
12
(6)
(1)
(2)
M.Sc. Physics
13
M.Sc. Physics
14