Fifth lecture: Problem-solving

1. Write a function called multP(n,m) which takes two integers as input. The output is a matrix, which is the $n\times m$ multiplication table.

2. Write a function called fibI(n), which takes a positive integer as an input. The output is the first index (i), for which the i. element of the Fibonacci-series is greater then n. (The first and second element of the Fibonacci series is 1, the k. element is the sum of the previous two elements).

3. Write a function called thisJanuary(n) which takes a integer between 1 and 31 as input. The function doesn't have an output but displays that which day of the week was the nth of January this year.

4. Write a function called olderOne(year1, month1, day1, year2, month2, day2) which takes six integers as inputs, which are the birthdays of the people. The output is 1 if the first one is older, 2 if the second one and 0 if they have the same age.

5. Write a function called swapV(v,a,b), which takes 3 inputs: the v rowvector, and the a and b floating point numbers. The output should be identical to v expect every item, which value equals to a should be changed to b.

6. Write a function called intervalMean(v), which takes a vector as an input. The output is the mean of the elemnts from v, whose value is between 0 and 1.

7. Write a function called histMod(v,a,b), which takes 3 inputs: v is a row vector, and a and b are floating point numbers. The function discards all values from v, whose values are less than a or more than b. After that, it creates a histogram from the remaining items.

8. Write a function called elliP(a,b), which takes two positive numbers as input. The function plots the parametric curve x(t)=a*cos(t), y(t)=b*sin(t), where the parameter t goes from 0 to 2*pi.

9. Write a function called houseP(s), which takes a string as an input. This string is the name of a .csv file, and you may assume, that this file is in our current working directory. The file contains 3 columns, and unknown number of rows, which are data of houses. The price is in the first column (in Forint), the area is in the second (in m^2), the number of bedrooms in the third. Your function has to import the data from this file, and the output is the mean price/m^2 for the houses having exactly 2 bedrooms.

10.* Write a function called flipP(A), which takes a matrix as an input. The output is a matrix, which we obtained by mirroring A's element to the diagonal going through the positions (1,n) and (n,1).

For example: flipP([1 2 3; 4 5 6; 7 8 9]) should be [9 6 3; 8 5 2; 7 4 1].