Mathematical Computations – MATLAB for Beginners – MATLAB Basics – Tutorials – Volume-2

Unit-8

Discrete Math

>> a=factorial(4)
a =
    24


>> factor(60)
ans =
     2     2     3     5


>> primes(10)
ans =
     2     3     5     7


>> gcd(10,100)
ans =
    10


>> lcm(5,45)
ans =
    45

>> isprime(7)
ans =
     1
>> isprime(10)
ans =
     0

>> perms([1 2 3])
ans =
     3     2     1
     3     1     2
     2     3     1
     2     1     3
     1     2     3
     1     3     2

Be the first to comment

Leave a Reply

Your email address will not be published.




twenty − 15 =