0% found this document useful (0 votes)
56 views6 pages

MATLAB Array Functions and Analysis

1) The document discusses a code that calculates the variance of an input array with values between 1 and 1000. 2) It also contains a code that counts the number of prime numbers between 1 and a given natural number N. 3) For an input array with values between 1 and 1000, the code calculates the variance and number of prime numbers.

Uploaded by

Pavan Sai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Topics covered

  • Function parameters,
  • Variance,
  • Debugging techniques,
  • Return values,
  • Code readability,
  • Prime numbers,
  • Performance optimization,
  • Modulus operator,
  • Code examples,
  • Input/output operations
0% found this document useful (0 votes)
56 views6 pages

MATLAB Array Functions and Analysis

1) The document discusses a code that calculates the variance of an input array with values between 1 and 1000. 2) It also contains a code that counts the number of prime numbers between 1 and a given natural number N. 3) For an input array with values between 1 and 1000, the code calculates the variance and number of prime numbers.

Uploaded by

Pavan Sai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Topics covered

  • Function parameters,
  • Variance,
  • Debugging techniques,
  • Return values,
  • Code readability,
  • Prime numbers,
  • Performance optimization,
  • Modulus operator,
  • Code examples,
  • Input/output operations

ROLL NO: EDM17B032

1) For any input in the form of Array:

Variance

If input is 1-1000, then,

2)
3)

This gives the number of prime numbers in first ‘N’ natural numbers
4)

5)
For 1:1000,

6)
The code given does the function of a modulus operator which returns the absolute value of the input given.
This can also be implemented without using for loop:
abs(number): It’s a built-in function in MATLAB which does the same job as the given function.

7)

It creates an array (1x1000) with random values between 0 and 1.


8)

You might also like