Lecture 12

# Lecture 12 - Lecture 12 Symbolic Math BMEn 2401 Programming...

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

11/29/2010 1 Lecture 12: Symbolic Math BMEn2401 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

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

View Full Document
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
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

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

View Full Document
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)) t = - x^4 - x^3*y - x*y^3 + x*y^2 - y^4 + y^3 s = collect (t, y) s = - y^4 + (1 - x)*y^3 + x*y^2 + (-x^3)*y - x^4 7 simplify command simplify (S) creates a simpler form of S : syms x S
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern