3/27/2008

矩阵的转置共轭就是厄米变换

conjugate transpose, Hermitian transpose, or adjoint matrix of an m-by-n matrix A with complex entries is the n-by-m matrix A* obtained from A by taking the transpose and then taking the complex conjugate of each entry. The conjugate transpose is formally defined by
(A^*)_{i,j} = \overline{A_{j,i}}

where the subscripts denote the i,j-th entry, for 1 ≤ in and 1 ≤ jm, and the overbar denotes a scalar complex conjugate. (The complex conjugate of a + bi, where a and b are reals, is abi.)

This definition can also be written as

A^* = (\overline{A})^\mathrm{T} = \overline{A^\mathrm{T}}

where A^\mathrm{T} \,\! denotes the transpose and  \overline A \,\! denotes the matrix with complex conjugated entries.

Other names for the conjugate transpose of a matrix are Hermitian conjugate, or transjugate. The conjugate transpose of a matrix A can be denoted by any of these symbols:

3/26/2008

matlab中画图技巧



例:t=0:0.1:10
y1=sin(t);y2=cos(t);plot(t,y1,'r',t,y2,'b--');
x=[1.7*pi;1.6*pi];//设定不同曲线的位置
y=[-0.3;0.8];
s=['sin(t)';'cos(t)']; // 不同曲线的标题
text(x,y,s);
title('正弦和余弦曲线');
legend('正弦','余弦') //分别不同的曲线
xlabel('时间t'),ylabel('正弦、余弦')
grid on

matlab中解析解和数值解一起求

方法就是先用syms 指令将其符号化,然后解方程得到解析解
然后将参数赋值,用eval 指令将其数值解求出。
例子

%hw6prob3

clear;
syms gamma omega delta;
diary hw6prob3.txt;
A1=[-gamma, i*omega,-i*omega,0;i*omega,-(gamma/2+i*delta),0,-i*omega;-i*omega,0,-(gamma/2-i*delta),i*omega;1,0,0,1],

B=[0;0;0;1],

X1=A1\B;
fprintf('The analytical solution for this linear equation is: \n ');
X1,

gamma=1;
omega=2;
delta=0;

fprintf('The numerical solution for this linear equation is: \n ');
X2=eval(X1),

diary off;

matlab中semicolon(分号)的巨大作用

To make Matlab give an output, such as return the value of a variable, you type the name of the variable without any semicolon (;) following the variable.
如果需要显示的话,不要加分号
In many cases, there is no need to see the value of a variable every single time Matlab uses it. If Matlab re-computes the value of a variable 1000 times, we probably don't want to see the result every single time. To surpress the output of a value, just add a semi colon after the variable. Then Matlab will perform the command, but will not show it on the screen.
不需要显示中间过程的话,加上分号.

例子
%solve linear equations

clear;
diary hw6prob2.txt;
fprintf('This just shows 5*5 matrix but 100*100 is basically the same.\n');
fprintf('The result for 100*100 matrix is just too large to show on one paper.\n');
N=5;
for j=1:N,
for i=1:N,
A(i,j) = 1/(i+j-1);//这里需要加上分号,这样可以不显示中间过程
end
end

for n=1:N;
B(n,1)=1/n;
end

A, //这里需要显示结果,所以不能加分号
B,

X=A\B;
fprintf('The solution for this linear equation is: \n ');
X,

diary off;

3/25/2008

matlab矩阵除法

推荐使用
z = A\b;

不推荐使用

y = inv(A)*b;

matlab中输出结果到文件

使用diary 命令,这里是一个例子。

%solve linear equations
diary hw6prob1.txt;
clear;
A=[4,-2,1;3,6,-4;2,1,8];
B=[20;-30;40];

Y=inv(A);
X=Y*B;
fprintf('The answers is: \n ');
X,
The
Y,
diary off;
红色的是关键所在,这两个命令之后,中间输出的X, Y就保存在
hw6prob1.txt
请看输出结果
The answers is:

X =

2.3194
-2.9658
4.7909


Y =

0.1977 0.0646 0.0076
-0.1217 0.1141 0.0722
-0.0342 -0.0304 0.1141