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

Info icon This 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 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
Image of page 1

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

View Full Document Right 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
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
Image of page 3

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

View Full Document Right 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)) 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
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern