Test 1 - MATLAB - sample
Sample Test I - MATLAB/Octave
You have 90 minutes to complete the test. The only materials that are allowed to be used are the tutorials and sites linked at http://jug.dpieczynski.pl/proj-eocst. Any attempts to cooperate or use of the Internet for any other way will result in immediate test termination for involved students.
Before the deadline the solution have to uploaded to a specified page at the Moodle course. The upload form closes automatically at the deadline, be sure to upload the solution before that time! The form only accepts following file extensions: .m
, .svg
.
The solution should consist of five files:
- task1.m
- task1a.svg
- task1b.svg
- task2.m
- task2.png
Task 1
Write a MATLAB/GNU Octave script and save it as task1.m:
- A Gaussian curve can be described with the following equation (where ex can be calculated using
exp(x)
function):
For values x = <-5. 5>, with 0.01 step, calculate g(x) function values for the following parameters sets:
- μ = -1; σ = 0.5,
- μ = 0; σ = 1,
- μ = 2; σ = 3.
Plot all 3 Gaussian curves in the first plot. Add axes descriptions: x and g(x). Add a plot title: Gaussian curves. Add axes descriptions: x and g(x). Enable grid display.
Calculate the sum of the 3 function values. Plot the result in the same window, with a dotted line.
Add a legend describing the series:
- u=-1; o=0.5
- u=0; o=1
- u=2; o=3
- sum
Save the figure as task1a.svg.
Find maximum value of the sum function from the previous task, display it in the console.
Clip the function to 50% of its maximum value: in points where the function value exceeds half of maximum value, assign half of the maximum value.
Plot the resulting function in a second window. Add a title: Modified sum of Gaussian curves.
Save the figure as task1b.svg.
Task 2
Write a MATLAB/GNU Octave script and save it as task2.m:
Load data from a CSV file: input_data.csv
For each column of the data, calculate its mean value and print it in the console:
Expected output:
Mean values of columns:
-92.537
-0.107
77.110
0.129
Generate a plot in new window with the third column as
x
values, and first column asy
values. If everything was correct the lines should generate a drawing.Save the plot as task2.png.
Authors: Jakub Tomczyński, Tomasz Mańkowski