Skip to content

MATLAB solution code for the Scientific Check assignment. Please read the readme.pdf file for easier navigation through the codebase files.

Notifications You must be signed in to change notification settings

Manikanta-17/CSIS-Scientific-Check-Assignment-University-of-Wuppertal

Repository files navigation

CSIS-Scientific-Check-Assignment-University-of-Wuppertal

MATLAB solution code for the Scientific Check assignment. Please read the readme.pdf file for easier navigation through the codebase files.

Self-Assesment Exercises: Basic programming

Questions:

  1. Write functions that take a matrix M of size N × N as an input and calculate the following quantities: a) The trace of the matrix. b) The sum, mean and maximum of the entries. c) The sum, mean and maximum of the absolute value of the entries. d) A vector of size N × 1 containing the mean of each row. e) A vector of size N × 1 containing the mean of each column. f) A matrix of size N × N containing the result of multiplying M with its transpose.
  2. Write a function that takes a matrix M of size N × N and a real number a as inputs and returns a matrix A of size N × N where the entry A(i, j) is 1 if M(i, j) ≥ a and −1 otherwise.
  3. Test all the functions using the matrix M of size 20×20 with entries given as M(i, j) = 1/2 (i − j) where i, j = 0, ..., 19
  4. Write a program which takes a vector of size N × 1 whose entries are real numbers and sorts it in ascending order.
  5. Write a program which computes prime numbers up to a given maximal number using the iterative algorithm called sieve of Eratosthenes. Note: - Write the corresponding code in any language without using built-in functions that can directly give the wanted results.

Answers:

Writing the corresponding codes in MATLAB without using built-in functions and comparing the non-built-in function results with built-in function results.

  1. Writing a MATLAB function code to compute solution for all sub-questions in question 1. Function code file is attached below with the name called “Assesment_function_code_1.m”
  2. Writing a MATLAB function code to compute solution for question 2. Function code file is attached below with the name called “Assesment_function_code_2.m”
  3. To test the above written function codes writing a script code which also includes comparison of non-built-in function results with built-in function results. Script file is attached below with the name called “Test_code.m”
  4. Writing a code which can sort any kind of real number array into ascending order. Code file attached below with name called “Real_Num_Ascending_order.m”
  5. Writing a code which can computes prime numbers up to a given maximal number using the iterative algorithm called sieve of Eratosthenes. Code file attached below with name called “Prime_Num_sieve_Eratosthenes.m”

About

MATLAB solution code for the Scientific Check assignment. Please read the readme.pdf file for easier navigation through the codebase files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages