October 21, 2010

some commands for matlab

matrix functions

 INV    Matrix inverse.
    INV(X) is the inverse of the square matrix X.
    A warning message is printed if X is badly scaled or
    nearly singular.

 .' Transpose.
    X.' is the non-conjugate transpose.
    B = TRANSPOSE(A) is called for the syntax A.' when A is an object.

 SQUEEZE Remove singleton dimensions.
    B = SQUEEZE(A) returns an array B with the same elements as
    A but with all the singleton dimensions removed.  A singleton
    is a dimension such that size(A,dim)==1.  2-D arrays are
    unaffected by squeeze so that row vectors remain rows.
    For example,   squeeze(rand(2,1,3))    is 2-by-3.

Especially, for a 3-dimension matrix, for the command "matri = original_matrix(1,:,:)", the resulting matrix matri is still a 3-D matrix whose 1st dimension is just 1.

==========

for plotting, this example will explain the most frequently used commands:

x = -pi:.1:pi;
y = sin(x);
plot(x,y);
set(gca,'XTick',-pi:pi/2:pi);
set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'});
xlabel('-\pi \leq \Theta \leq \pi');
ylabel('sin(\Theta)');
title('Plot of sin(\Theta)');
AXIS([XMIN XMAX YMIN YMAX])
XLIM([XMIN XMAX])
YLIM([YMIN YMAX])

No comments:

Post a Comment

Days of our lives

Daisypath Anniversary tickers