4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

[Algorithm Trading #3] MATLAB 101

Hi,

Today, I am going to briefly introduce how to use MATLAB.
If you have no plan to buy the MATLAB licence, you could try Octave as an alternative.

01_title.png

MATLAB is a matrix-oriented language where you could easily define and manipulate matricies.

02_matlab.png

03_matrix1.png

In prompt, if you type

a=0

then you are creating a 1x1 matrix with an element is 0.

Also, if you type

b=[1;2;3]

then you declare a vector with element 1,2,3 where ; makes column vector.

matrix2.png

Also, you could define a random matrix with

rand()

inverse matrix with

inv()

eigen analysis with

eig()

command.

matrix3.png

Let's draw sine function that is drawn in the first figure.

x = (0:0.1:10)'

it defines a vector from 0 to 10 where one step is 0.1. the ' makes the column vector.

If you apply sine function,

y = sin(x)

then you obtain a vector with output of sine function.
Plot the x and y using

figure; plot(x,y)

makes the figure on the right.

It's quite easy and straight-forward, right?

20 upvotes 1 downvotes $0.72

Replies (18)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: