Lecture 12 - 11/29/2010 Lecture 12: Symbolic Math BMEn 2401...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
11/29/2010 1 Lecture 12: Symbolic Math BMEn 2401 Programming for Biomedical Engineers Rich Beck November 30, 2010 So far all of the variables that we have used had numeric values: X = 12; Y = X^2 Y = 144 Symbolic operations are used when specific values are not given: a*x – b = 0 → x = b/a 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
11/29/2010 2 syms command Define symbolic variable(s) first by using the syms command: syms x y z = x + y z = x + y t = z^2 3 expand command expand command expands algebraic expressions: syms x y z = (x+y)^2 z = (x + y)^2 t = expand(z) t = x^2 + 2*x*y + y^2 4
Background image of page 2
11/29/2010 3 expand command syms x y z = sin ( x + y ) z = sin(x + y) t = expand(z) t = cos(x)*sin(y) + cos(y)*sin(x) 5 expand command clear syms x y z t = expand ( sin ( x + y - z )) t = cos(x)*cos(z)*sin(y) - cos(x)*cos(y)*sin(z) + cos(y)*cos(z)*sin(x) + sin(x)*sin(y)*sin(z) 6
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
11/29/2010 4 collect command s = collect (t,y) collects terms with the same power of y in the expression s together: syms x y t = expand ((x+y)*(y^2-x^3 -y^3))
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

Lecture 12 - 11/29/2010 Lecture 12: Symbolic Math BMEn 2401...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online