Professional Documents
Culture Documents
Chapter -2
Visualization and Programming
[ ]
1 1 1 1 ¨ 1 1
¨
𝑦 (𝑡 )+ + + ˙
𝑦 (𝑡 )+ 𝑦 (𝑡)= 𝑥 (𝑡 )
𝐶 2 𝑅1 𝑅 2 𝑅 3 𝑅1 𝑅2 𝐶1 𝐶2 𝑅1 𝑅 3 𝐶 1 𝐶 2
λ +
21 1
+
1
+
[
𝐶 2 𝑅 1 𝑅2 𝑅3
1¨
λ +
1
𝑅1 𝑅2 𝐶1 𝐶2]=0
Operation-amplifier circuit
• first case, assign nominal component values of R1 = R2 = R3 • Unlike script M-files, function M-files can accept input
= 10 kΩ and C1 = C2 = 1μF. arguments as well as return outputs
• function [lambda] = CH2MP2(R,C)
Element ~A not(A)
complement
IF ELSE ELSEIF
if cond if cond if cond1
commands commands1 commands1
end else elseif cond2
commands2 commands2
end else
q commands3
Conditional
statement: end
evaluates to true
or false
terminates the
No need for parentheses: command provide for the
last group of .
blocks are between reserved words statements execution of alternate
04/03/2023 Chapter One groups of statements 9
Cont’d
Switch/For/While
Basic flow-control, common to all languages