100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Handleiding

An explanation of Matlab tutorials

Beoordeling
-
Verkocht
1
Pagina's
20
Geüpload op
11-12-2017
Geschreven in
2017/2018

The codes written during the matlab tutorial with a step by step explanation of what we are programming.











Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Documentinformatie

Geüpload op
11 december 2017
Aantal pagina's
20
Geschreven in
2017/2018
Type
Handleiding
Bevat
Onbekend

Voorbeeld van de inhoud

Commands
Arrays and Matrices
Name = begin number:step width:end number
If there is no step width defined than it is automatically one

(begin number ⋯ end number)

Name = [number1, number2, number3; number4, number5, number6]

(number
number 1
4
number 2 number 3
number 5 number 6 )
size(Name)
number of rows , number of columns

Name = linspace( begin number, end number, number of steps)
(begin number ⋯ end number)
For example linspace (0,10,3)
(0 5 10)
If you don’t define a number of steps Matlab automatically assumes you want 100 steps

randn(n, m)
return a matrix n x m matrix of normally distributed random numbers

Saving and loading of documents
save (‘file_name’)
load (‘file_name.mat’)

Clearing Matlab
clear
this command clears the workspace

clc
this command clear the command window

Reading in file
Filename = ‘file.csv’

Name = cvsread(filename)
Read in comma separated file

Name(:,colomn number)
Prints that colomn

Name = num2string(filename)
Convert numerical data into a data string

dataNumber = datenum(date_strings, ‘yyyymmdd’)
Turns a date string into matlab internal date numbers

Dates = datastr(dataNumber, formatOut)
Format matlab internal date numbers into readable date numbers. The Formatout is the format you get the
dates in. If you for example use 24 as formatOut you get the dates in the following manner dd/mm/yyyy.
Instead of 24 you can also write ‘dd/mm/yyyy’ as FormatOut.

,New_vector = Name(:,column)
Write a certain statistic in own vector

 If you want to have a vector with the log returns you have to create a vector with only closing prices.
Then create a new vector by using the following formula
Log_returns = diff(log(closeprices))
Graphs
plot (Name)
plot vector Name in a graph. If the input is a matrix Matlab will plot each column.

plot( Namex, Namey)
Plot vector Namey in a graph and use Namex as the x-coordinates

 If you want to plot the log returns Namex is dateNumber(2:end), because you are taking difference the
first data point gets lost in the process. This will plot the returns against the matlab internal dates. If
you want readable date to be on the x-axis you have to use the following command
datetick (‘x’)

title(‘title_name’)
xlabel(“xlabel_name’)
ylabel(“ylabel_name’)
The commands above will add a title and/or labels fort the x-axis and y-axis

qqplot(name)
Displays a quantile-quantile plot of the quantiles of the sample data versus the theoretical quantiles values from
a normal distribution.

qqplot(name)
Displays a quantile-quantile plot of the quantiles of the sample data versus the theoretical quantiles values from
the distribution specified

Basic data analysis
length(name)
Gives the number of observations

sum(name)
Gives the sum of all the observations

prod(name)
Gives the product of all observations

min(name)
max(name)
Gives the minimum and maximum of all the observations

range(name)
Gives the difference between the minimum and maximum

mean(name)
median(name)
var(name)
std(name)
sqrt(var(name))
skewness(name)
kurtosis(name)

, Gives information about the distribution of the variable name

corrcoef(name)
Returns the matrix of correlation coefficients for name, where the columns of name represent random variables
and the rows represent observations.

quantile(name, probability)
Gives you the value that belongs to that probability. The chance that a value is smaller than the output is equal
to the probability you put in for input

sort(name)
Puts the values of the vector in the order from small to large

abs(name)
Makes all the values of the vector absolute

diff(name)
Takes the differences between the observations

Matrix Calculations
MatrixA= [number 1, number 2; number3, number 4]
MatrixB= [number 5, number 6; number7, number 8]
MatrixA .* MatrixB

(number 1∗number 5
number 3∗number 7
number 2∗number 6
number 4∗number 8 )
MatrixA * MatrixB
Multiplying matrices the same way as always (row times column)

MatrixA’
Gives the transpose of matrix A

Distributions
normalpdf(x, mu, sigma)
the chance you find value x in the normal distribution with mean mu and standard deviation sigma. If you put in
a vector your output will be a vector with probabilities. If mu and sigma are not defined Matlab assume mu to
be zero and sigma to be 1 (Z-distribution).

normalcdf(x, mu, sigma)
the chance you find value x or smaller in the normal distribution with mean mu and standard deviation sigma. If
you put in a vector your output will be a vector with probabilities. If mu and sigma are not defined Matlab
assume mu to be zero and sigma to be 1 (Z-distribution).

norminv(p, mu, sigma)
The output is the value for which the probability you will obtain that exact value or something smaller, is equal
to p.

normrnd(mu, sigma, number of rows, number of columns)
Creates a matrix with every cell containing a random variable of a normal distribution with mean mu and
standard deviation sigma.

[muhat,sigmahat,muci,sigmaci] = normfit(name)
Estimates the mu and sigma for each colomn of data. Also gives the confidence intervals (first a row with the
lower bound and then a row with upper bounds). If muci and sigmaci aren’t put in you only receive the
estimates as output

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
wandykalk Vrije Universiteit Amsterdam
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
80
Lid sinds
8 jaar
Aantal volgers
55
Documenten
17
Laatst verkocht
1 jaar geleden

3,9

19 beoordelingen

5
3
4
12
3
4
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen