MATLAB for discrete and polynomials functions
Discrete functions:
A set of data is said to be discrete if the values belonging to the set are distinct and separate (unconnected values). In the graph of a discrete function, only separate, distinct points are plotted, and only these points have meaning to the original problem.
The basic matlab discrete functions are factor, factorials, gcd, isprime, lcm, nchoosek, perms, primes, rat and rats .
factor | Prime factors |
factorials | Factorial of input |
gcd | Greatest common divisor |
isprime | Determine which array elements are prime |
lcm | Least common multiple |
nchoosek | Binomial coefficient or all combinations |
perms | All possible permutations |
primes | Prime numbers less than or equal to input value |
rat | Rational fraction approximation |
rats | Rational output |
These functions are used as follows in matlab:
Factor:
y = factor(n) % It will generate a row vector y = factor(20) = 2 2 5 % Row and column vector will be discussed in next article Input value can be reproduced by multiplying the elements of y. Which is as follows: prod(y) =20
Factorial:
The factorial, symbolised by an exclamation mark (!), is a quantity defined for all integers greater than or equal to zero. The factorial value of 0 is defined as equal to 1. The factorial values for negative integers are not defined.
y = factorial(n)
y = factorial(n) returns the product of all positive integers less than or equal to n, where n is a nonnegative integer value. If n is an array, then f contains the factorial of each value of n. The data type and size of y is the same as that of n.
y = factorial(5) = 120 To evaluate factorial of longer digits you need to set format as follows: format long y = factorial(22) = 1.124000727777608e+21 Factorial of Array elements n = [0 1 2; 3 4 5]; y = factorial(n) = 1 1 2 6 24 120
gcd:
G = gcd(A,B)
[G, U, V] = gcd(A, B)
G = gcd(A,B) returns the greatest common divisors of the elements of A and B. The elements in G are always nonnegative, and gcd(0,0)returns zero. This syntax supports inputs of any numeric type.
[G, U, V] = gcd(A, B) also returns the Bézout coefficients, U and V, which satisfy: A.*U + B.*V = G. The Bézout coefficients are useful for solving Diophantine equations. This syntax supports double, single, and signed integer inputs.
Note: gcd returns positive values only.
A = [-2 17; 10 0]; B = [-4 3; 100 0]; G = gcd(A,B) = 2 1 10 0
LCM:
LCM stands for Least common multiple. Definition of LCM can be given as “It is a smallest common prime factor of two or more number except zero “.
L = lcm(A,B) % where A & B are numbers
L = lcm(A,B) produces least common multiple of A and B.
A = 5 B = 45 L = lcm(A,B) L = 45 LCM of an array and a sclar A = [5 17, 10 60]; B = 45; L = lcm(A,B) L = 45 765 90 180
Polynomials functions:
A polynomials functions is mathematical expression which includes constant and variables along with arithmetic operators. Such as quadratic equations, cubic equations and higher order equation.
Some polynomial functions which are being used commonly:
poly | Polynomial with specified roots or characteristic polynomial |
ployeig | Polynomial eigenvalue problem |
ployfit | Polynomial curve fitting |
residue | Partial fraction expansion (partial fraction decomposition) |
roots | Polynomial roots |
polyval | Polynomial evaluation |
ployvalm | Matrix polynomial evaluation |
conv | Convolution and polynomial multiplication |
dconv | Deconvolution and polynomial division |
polyint | Polynomial integration |
polyder | Polynomial differentiation |
Hi there, its fastidious paragraph about media print, we all understand media is a
wonderful source of facts.
Hi,
Thanks for your valuable time and appreciation. In near future we are coming up with new categories like Latex, kile and CSS etc. We are also adding small video and gif images to make it more understandable to users. So keep visiting http://www.paperguide.org
Thanks!
Saved as a favorite, I actually enjoy your site!
Hi Lurlene,
Thanks for your valuable time and appreciation. Your appreciations gives us positive strength to make this website more valuable.
Thanks & regards
Ramesh
It’s difficult to find well informed people on this matter, but you seem
like you comprehend what you’re talking about! Thanks
Great post. I am confronting a couple of these problems.
Hey there this is kind of of off topic but I was wanting to know if blogs use WYSIWYG
editors or if you have to manually code with HTML. I’m starting a
blog soon but have no coding experience so I wanted to get advice from someone with experience.
Any help would be greatly appreciated!
Hi,
We are happy to help you. In our blog paperguide we are using wordpress instead of WYSIWYG. We also use to write our own in html and php whenever it is required. To know more about it have look at our article how to start a blog.
Thanks and regards
Ramesh
MATLAB also provides the polyvalm function for evaluating a matrix polynomial.
Hi,
Thanks for your valuable suggestion. We will add it in list of functions asap.
Thanks and regards
Ramesh
Hi there, all is going well here and ofcourse every one is sharing facts, that’s genuinely excellent, keep up writing.
Wonderful article! We will be linking to this particularly great article on our website.
Keep up the good writing.
Awsome site! I am loving it!! Will be back later to read some more. I am taking your feeds also
I just want to tell you that I am very new to blogging and seriously enjoyed this page. More than likely I’m going to bookmark your blog . You actually come with good articles and reviews. Cheers for revealing your blog.