Finding Roots of Polynomials in MATLAB

For this task, MATLAB provides a useful function called ROOTS that finds the solution x of the equation y = f(x) = 0 where f(x) is a polynomial. First, lets define a polynomial in array form. x^2-x+3 translates to

To find the roots simple do

In this case, the roots were complex numbers. […]
Continue reading…

 

Numerical Integration in MATLAB

QUAD and QUAD8 functions are used for numerical integration in MATLAB. QUAD is based on adaptive-recursive Simpson’s rule, whereas QUAD8 is based on adaptive-recursive Newton-Cotes eight-panel rule. Their syntax is the same and like this QUAD/QUAD8(func, A, B, T) func as you can guess is the function name for desired function to be integrated. A […]
Continue reading…

 

Sieve of Eratosthenes in Matlab (aka. Prime number finder)

Continue reading…

 

Perfect Numbers Finder in Matlab

Continue reading…

 

GCD, LCM Functions in Matlab

Continue reading…

 

Palindrome Checker in Matlab

source:rosettacode.org
Continue reading…

 

Generating Spirographs in Matlab

Sample: spirograph
Continue reading…

 

Approximating Cube Root Function in MATLAB

Continue reading…

 

Approximating Cosine in Matlab

Continue reading…