Saturday, 22 October 2011

Again moving on... now lets see a bit of Control System in MATLAB...
To start with how to define a transfer function in Laplace Domain...
its simple...just use the command "tf"
say
>>num=[0 0 1];
>>den=[1 2 1];
>>tf(num,den)
 will give the pout put as
:
1/(s^2+2s+1)

Try this out.... and for more on Control System Toolbox type
>>help control

Don't worry I will go through all tools you might need in Control System Toolbox...in a few days...
So long...

OK......Now many of you would be thinking how would you get to know all these functions rite.... apart from the help in MATLAB, you can goto MATLAB CENTRAL in the Mathworks Website to know more about Matlab and ask others questions, if you have any....
You can also get Books about Matlab from AMAZON or such sites...

Monday, 10 October 2011

Matrix Functions

Hello guys...
 I would now talk about some matrix functions...
You engineering students might be wondering how would you put a matrix to the power of "e"...
its quite simple ... use the command expm(<MATRIX NAME>)


 Then to make a matrix full of zeros?? Its even more simple... use the command
zeros(<size of matrix>)
 Will give you a matrix filled with zeros .
The length(<matrix name >) command gives the length of the matrix and size(<matrix name >) gives the size of the matrix as the answer.

In order to make the transpose of a matrix all you need to put is a " ' " symbol next to a matrix
Just like this A'


Alright  folks I guess that should wrap up the Matrix part of it... Next time we shall talk about some plotting and other functions....
So long...!

Sunday, 9 October 2011

Matrix Operation

Now lets get serious with matrices shall we??

Right....
I shall go through  some of the commands of Matrix operation...
1) Inverse of a matrix...
        Simple as it sounds just use the command inv(<matrix name>) shall give you the output as the inverse of the matrix

2)Determinant of matrix
      det(<matrix name>)

3)eigenvalues of a matrix
     eig(<matrix name>)

4)How to make an Identity matrix??
  Its very easy eye(<size of matrix>)
 
   like eye(2)... gives a 2by2 Identity matrix and eye(2,3) gives an identity matrix of size 2by3

Isn't it fun??
You might wanna know more commands...its not really easy to remember all commands thats what is help in Matlab for...
If u have a doubt in something just type
     help <keyword>
To get help in any topic.

So don't ever feel you don't know Matlab because Matlab is there always to help you out in your troubles...


Let's get serious

So after the first running around MATLAB command window you should be familiar how it works as a calculator..if not just try all Mathematical operations lie + - * / ^..anything... as long as syntax is correct MATLAB should give an out put like
>> ans =


Ok...now lets get in to the business of matrices.
I hope everyone knows what a Matrix is...if not it looks something like this...
A=  2 3 4
       2 3 3
Well, how do you put this in to Matlab?
its easy... just type

A=[2 3 4; 2 3 3]

this should give you an output like this
See how beautifully Matlab gives the output

Now you might know a set of operations to be done on matrices... well its time to get that started...

First Addition of Matrices


A=[2 3 4; 2 3 3];
B=[1 3 4; 1 3 3];

A+B

gives the output

>> ans =

    3     6     8
    3     6     6


Just like these try using Subtraction, multiplication ...
But in order to multiply 2 matrices there is a rule you have to follow that... the rule is as follows
"In order to multiply 2 matrices A and B , the order of A being i*j , then the order of B must be j*k"

Meaning the number of columns in "A" should be equal to number of rows in "B" .... Its easy ...  :)
Try them out until my next post...
So long!



Hi everyone who talks the language of Maths and Engineering (Not that MATLAB has any affiliation to only one of these subjects!).....
Anyways.. through my Bachelor's Degree and with the start of my Masters Degree I'm seeing a lot of my friends and fellow students struggling with MATLAB... So I thought I would sit down some moment to kick some ass for you guys who are struggling with MATLAB....

To start with... Have you installed MATLAB??.. If you have good... else ..please get one copy and install it..nothing I can help you in that..(sadly..)
Now lets get started with it.... When you start MATLAB you might see a window ..something like this..
..this is called the COMMAND WINDOW..
Its just like the DOS prompt... 
Now try these simple steps
 type 
A=10
B=10
A+B
you might see an output like this;...
>> ans=20

Well, that means A+B=10+10=20... So you just made your MATLAB function like a calculator...
Try such commands and have fun ... for now... We will deal with Matrix functions later on...

So have fun...!