[Algorithm Trading #3] MATLAB 101

in trading •  7 years ago 

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?

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

matplotlib works great for this as well :] Followed.

You must be working on python :) welcome

Yup, love me some good python. Throw in some SciKit-Learn and pyBrain.... things get realllll fun. :]

I use Keras with Theano backend. I run 5 GPUs for my research. Good to work

Is this supposed to be a kind of calculator or a mini computer? What do you think will be the impact of this for students who need to do these calculations with their head?

MATLAB is a programming language for scientific computation. And students wouldn't do this computation mannually since it is too tidious.

Matrix is not that tedious I can close my eyes and do some matrix bro...

Wow you must be geneous man

I am not. It is not as difficult as you think.

  ·  7 years ago (edited)

Well, here we can see only basics(i don't know how this post made 85$ atm) anyway matlab is for complex simulations, engineering computations, or numerical analysis . It is also good to learn biometrics algorithms. No one will ever (in 2017) make such computations manually :)

Seems like you jealous about this post. The concents are very easy since it is an introductory post. I will post more on algorithmic details in future post like trading signal analysis and optimizer to find optimal trading signal.

Example of one-way thinking. Someone who criticizes you must be jealous. Good luck mate. If next time you post something more complex then "lmgtfy -> matlab tutorial" i will upvote you.

Ok thanks for the clarification. I was viewing it as a device you have to use to do the computation.

Good post

Thank you

Just curious, whats your opinion of MATLAB compared to more common programming languages? I've written algo systems in C# and JS but have never even touched MATLAB.

Fast prototyping in mathematical modelling is the strong feature of matlab. So you could define vectors and matricies and apply mathematical operation on them.
In common language like C# and Java those kinds of mathematical operations are hard to implement. Instead they have a strong feature on defining class.

Check out julia programming language https://julialang.org/ it's many times faster then matlab