Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Monday, July 15, 2013

Matrices!

Hello everyone :-)

All right let's begin with the nets and bolts (haha!) of matrices.
What is a matrix? Aside from its namesake movies that raked in millions, what is it?
It's a representation of numbers is what it is.
Disappointed? Don't be, matrices are one of the funnest and most important topics in mathematics. They crop up everywhere like tiny rabbits out of the vast ground that is maths.

Fine. Enough prosaic things for now.

How can you actually represent numbers? We've already discussed the number line, so that's a way. But the number line is limited that it is one-dimensional.
A 1-D, or one dimension, can represent one quantity. It could be simply numbers. Of dresses, chocolates, fruits, so on.

Now for 2-D.

You might be accustomed to the graphs you draw in classes, with the two axes- X and Y. What makes it 2 dimensional? The simplest answer is that there are two quantities. For example:
X could be the candies you want to buy and Y could be the money corresponding to the X candies you want to buy. For instance, 10 candies might cost 200 dollars (in a ridiculously fancy shop maybe!).

How do matrices help? With the matrix structure you can represent numbers in 2-D, and larger dimensions too!

For instance:

if X= [1 2 3 4 5 6]
Y=[20 40 60 80 90 100]

where X= no.of pens
Y= cost of the pens

You could represent it as:














Aside from it being so big( magnified so it will be clearer), what strikes you about this?
From a clumsy set of 2 data, which will be tiresome to write everytime you want to express it, you could draw a simple structure. The first row is X and the second row is Y.
Remember, matrices can be 1 dimensional too, like X and Y are both 1-D. But it can also be used in larger dimensions.

MATLAB IMPLEMENTATION:

Okay, as I discussed in my previous article, I will be providing snippets of matlab code.
Here it is. I've done a printscreen of the matlab windows- which consist of blank M-file and workspace.



Okay the code is as follows:

close all
clear all

X=[1 2 3 4 5 6];
Y=[20 40 60 80 90 100];

C=[X;Y];
disp(C)
plot(X,Y)

This I have written in an M-file, which is where you write your code in MATLAB.

The workspace window is on the left, where the output is displayed.

The plot function plots X vs. Y.


















All right, that concludes it for today. As always, a pleasure and hope you learnt some interesting things! :-)

No comments:

Post a Comment