Matlab
http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do
http://blogs.mathworks.com/loren/2008/04/23/matlab-publishing-for-teaching/
http://en.wikibooks.org/wiki/MATLAB_Programming
http://matlab.exponenta.ru/index.php
d = eig(A) returns a vector of the eigenvalues of matrix A.
[V,D] = eig(A) produces matrices of eigenvalues (D) and eigenvectors (V) of matrix A, so that A*V = V*D. Matrix D is the canonical form of A — a diagonal matrix with A's eigenvalues on the main diagonal. Matrix V is the modal matrix — its columns are the eigenvectors of A.
http://texas.math.ttu.edu/~gilliam/ttu/mlhtml_1/m4330_ml_1.html
http://texas.math.ttu.edu/~gilliam/ttu/mlhtml_1/matlab-5.html
http://edu.levitas.net/Tutorials/Matlab/symbolic.html
http://texas.math.ttu.edu/~gilliam/ttu/mlhtml_1/symbolic/symbolic.html
L=sym('L')
syms L
a=[1-L 3 -1;3 4-L -2;-1 -2 2-L]
det(a)
ans = -6+7*L^2-L^3
Ax=b => x=A^(-1) * b
>> inv(a)
ans =
[ -(4-6*L+L^2)/(6-7*L^2+L^3), -(3*L-4)/(6-7*L^2+L^3), (2+L)/(6-7*L^2+L^3)]
[ -(3*L-4)/(6-7*L^2+L^3), -(L^2-3*L+1)/(6-7*L^2+L^3), (2*L+1)/(6-7*L^2+L^3)]
[ (2+L)/(6-7*L^2+L^3), (2*L+1)/(6-7*L^2+L^3), -(L^2-5*L-5)/(6-7*L^2+L^3)]
to esimate for some specific value:
L=1
eval(a)
Determinant of symbolic matrix:
m = sym('[d^2 2 7; d d^3 9; 1 5 1/5]');
det(m)
==============
x^2 -2*x -5=0
=====================
%numerical way:
roots([1 -2 -5])
ans =
3.4495
-1.4495
% symbolic way
solve('x^2 -2*x -5=0')
ans =
1 - 6^(1/2)
6^(1/2) + 1
% solve the general quadratic a*x^2+b*x+c=0 in terms of a,b and c
syms a b c x;
y=solve(a*x^2 +b*x+c)
y =
-(b + (b^2 - 4*a*c)^(1/2))/(2*a)
-(b - (b^2 - 4*a*c)^(1/2))/(2*a)
int('cos(x)^2')
ans =
x/2 + sin(2*x)/4
int('arctan(x)/x^(3/2)',0,1)
simplify(int('sqrt(1+cos(x)^2)'))
syms k,x
f=x*sin(x)*cos(k*x);
int(f)
ans =
1/2/(1+k)^2*(sin((1+k)*x)-(1+k)*x*cos((1+k)*x))-1/2/(-1+k)^2*(sin((-1+k)*x)-(-1+k)*x*cos((-1+k)*x))
diff('log(x)')
dsolve('D2y = -a^2*y', 'y(0) = 1', 'Dy(pi/a) = 0')
[x,y]=solve('x^2+y^2=1','x^3-y^3=1')
http://www.blinkdagger.com/matlab/intro-to-statistics-matlab-style
http://www.blinkdagger.com/matlab/intro-to-statistics-descriptive-statistics
http://rrc.dgu.ru/res/matlab/statist/book2/index.html
M-Lint, the static code analyzer that ships with core MATLAB. You can either access it via the editor or command line.
output = mlint('initial.m');
preallocation, vectorization, and only doing calculations a single time. However, there are also additional techniques to help you speed up your MATLAB code such as using the profiler to diagnose bottlenecks, using MEX-files, using bsxfun, and enabling multithreading. The documentation for MATLAB has a very helpful section entitled Performance.
The MATLAB Compiler and the deployment tools create deployable applications by "freezing" a collection of MATLAB functions and state information into a portable package. Deployed applications run using the MATLAB Component Runtime (MCR), which "thaws" the functions and state back into executable form. The Compiler creates either standalone executables or shared libraries (DLLs). Many of the differences between MATLAB and the MCR arise because a single user-written application may make use of multiple Compiler-generated shared libraries; in this case the shared libraries share the MCR's global data.
The MCR differs from MATLAB in five ways:
The MCR has no desktop.
The MCR only executes encrypted M-files.
Global MCR resources, like the Handle Graphics root object and the random number seed, are shared between multiple libraries working together.
The M-File and Java paths are fixed and cannot be changed.
Certain MATLAB and toolbox features are not available to deployed applications.
Because the MCR differs from MATLAB, M-Files written to run using the MCR may sometimes differ from M-Files that run only in MATLAB. Generally speaking, the differences between MATLAB and the MCR fall into four categories:
Finding functions at compile time
Path management at runtime
Non-deployable features
Differences in behavior
high-level import functions: xlsread, load
low-level functions: textscan, fread
Stuart's textscantool allows you to easily bring this data in, by working in conjunction with MATLAB's textscan function. It provides a nice graphical interface to quickly parse through a formatted ascii file and construct an automated import function for reading similar files.
A linear, or first degree polynomial: y(x) = a1*x + a2. In MATLAB we will merely store the coefficients, as a vector [a1,a0]. Note that a polynomial in MATLAB has it's coefficients stored with the highest order term first.
x = -1:.1:1;
y = exp(x);
plot(x,y,'bo')
xlabel X
ylabel Y
grid on
title 'Exponential data'
P1 = polyfit(x,y,1)
P1 =
1.1140 1.1937
% evaluate the polynomial with polyval:
yhat = polyval(P1,x);
plot(x,y,'bo',x,yhat,'r-')
xlabel X
ylabel Y
grid on
title 'Linear polynomial fit'
res = y - yhat;
plot(x,res,'bo')
xlabel X
ylabel Residuals
grid on
title 'Residuals for the linear fit'
%second order (quadratic) polynomial:
P2 = polyfit(x,y,2)
yhat = polyval(P2,x);
plot(x,y,'bo',x,yhat,'r-')
xlabel X
ylabel Y
grid on
title 'Quadratic polynomial fit'
res = y - yhat;
plot(x,res,'bo')
xlabel X
ylabel Residuals
grid on
title 'Residuals for the quadratic fit'
http://demonstrations.wolfram.com