A different way to solve this—a different algorithm
(( 2 * x - 1) * x) - 7) * x + 12
Horner’s rule
Algorithm quality
Clarity
Efficiency
Testing matters
Do it with several inputs picked so that you know the answers your code should produce
Yet another way to solve this problem (though it uses Matlab features a litle ahead of where we are)
polyval function
Hypotenuse
Typical solution
x = 78
y = 891
sqrt( x^2 + y^2 )
Or hypot( x, y )
Symbolic math
syms c
solve …
Very interesting part of Matlab, but can also be very confusing because it
puts Matlab into a mode where it treats some variables as
programming language variables (i.e., containers for values)
and others as mathematical variables (i.e., abstract symbols
for not-completely-known values)
Next
Continue variables and expressions lesson, especially quadratic equation part
Watch “What Is an Algorithm” video lecture at
https://cloud.ensemblevideo.com/app/sites/index.aspx?destinationID=IlO-D-b-vUWVkAsj2Is5Zg