📄 ch4_1_3.htm
字号:
<! Made by Html Translation Ver 1.0>
<HTML>
<HEAD>
<TITLE> 复数 </TITLE>
</HEAD>
<BODY BACKGROUND="bg0000.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img/bg0000.gif">
<FONT COLOR="#0000FF">
<H1>4.1.3 复数</H1>
</FONT>
<HR>
<P>
要说明复数的运算,先从解以下的二次方程式的复数根谈起
<P>
<A NAME="work"><IMG SRC="img00001-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img4/img00001.gif"></A>
<P>
上式的根有实部 (-2) 及虚部 (<FONT SIZE=2>±</FONT>3),我们就这个复数的表示法来说明
MATLAB的复数功能。MATLAB 是以<FONT COLOR=#FF0000>i</FONT>或<FONT COLOR=#FF0000>j</FONT>字元来代表虚部,其它的复数相关函数有<FONT COLOR=#FF0000>real</FONT>,
<FONT COLOR=#FF0000>imag</FONT>, <FONT COLOR=#FF0000>conj</FONT>,
<FONT COLOR=#FF0000>abs</FONT>, <FONT COLOR=#FF0000>angle</FONT>等等,详见线上说明<FONT COLOR=#FF0000>lookfor
complex</FONT>。如果复数表示为 <I>x=a+bi</I>
<P>
共轭复数 <IMG SRC="img00002-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img4/img00002.gif">=<IMG SRC="img00003-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img4/img00003.gif">, 复数大小r
=<IMG SRC="img00004-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img4/img00004.gif">, 复数向量的夹角 θ= tan<SUP>-1</SUP>
(<I>b/a</I>)
<P>
复数实部<I>a = r cos</I>θ, 复数虚部<I>b = r sin</I>θ, 复数指数表示法
<I>x</I>=r e<I><SUP>i<IMG SRC="img00005-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img4/img00005.gif"></SUP></I>
<P>
上述各函数对应MATLAB的复数指令为
<P>
a=<FONT COLOR=#FF0000>real(x)</FONT>, b=<FONT COLOR=#FF0000>imag(x)</FONT>,
<IMG SRC="img00006-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img4/img00006.gif"> =<FONT COLOR=#FF0000>conj(x)</FONT>,
r=<FONT COLOR=#FF0000>abs(x)</FONT>, <IMG SRC="img00007.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img4/img00007.gif">=<FONT COLOR=#FF0000>angle(x)</FONT>,
x=<FONT COLOR=#FF0000>r*exp(i*angle(x))<BR>
</FONT>
<P>
以下是几个复数表示式的例子:
<P>
<FONT COLOR=#FF0000>>> x=1-2*i; % 注意是 2*i 不是 2i</FONT>
<P>
<FONT COLOR=#FF0000>>> real(x) % 列出实部</FONT>
<P>
<FONT COLOR=#FF0000>ans =</FONT>
<P>
<FONT COLOR=#FF0000>1</FONT>
<P>
<FONT COLOR=#FF0000>>> imag(x) % 列出虚部</FONT>
<P>
<FONT COLOR=#FF0000>ans =</FONT>
<P>
<FONT COLOR=#FF0000>-2</FONT>
<P>
<FONT COLOR=#FF0000>>> conj(x) % 计算共轭复数</FONT>
<P>
<FONT COLOR=#FF0000>ans =</FONT>
<P>
<FONT COLOR=#FF0000> 1.0000 + 2.0000i</FONT>
<P>
<FONT COLOR=#FF0000>>> abs(x) % 计算复数的大小</FONT>
<P>
<FONT COLOR=#FF0000>ans =</FONT>
<P>
<FONT COLOR=#FF0000>2.2361</FONT>
<P>
<FONT COLOR=#FF0000>>> angle(x) % 计算复数向量的夹角(以径度表示)</FONT>
<P>
<FONT COLOR=#FF0000>ans =</FONT>
<P>
<FONT COLOR=#FF0000>-1.1071<BR>
</FONT>
<P>
<FONT COLOR=#FF0000>>> a=1; b=4; c=13;</FONT>
<P>
<FONT COLOR=#FF0000>>> x1=(-b+sqrt(b^2-4*a*c))/(2*a) %
以解二次方程式根的公式计算复数根</FONT>
<P>
<FONT COLOR=#FF0000>x1 =</FONT>
<P>
<FONT COLOR=#FF0000>-2.0000 + 3.0000i</FONT>
<P>
<FONT COLOR=#FF0000>>> x2=(-b-sqrt(b^2-4*a*c))/(2*a)</FONT>
<P>
<FONT COLOR=#FF0000>x2 =</FONT>
<P>
<FONT COLOR=#FF0000>-2.0000 - 3.0000i<BR>
</FONT>
<P>
<FONT COLOR=#FF0000>>> y=exp(i) % 以复数指数方式表示一个复数</FONT>
<P>
<FONT COLOR=#FF0000>y =</FONT>
<P>
<FONT COLOR=#FF0000>0.5403 + 0.8415i</FONT>
<P>
<FONT COLOR=#FF0000>>> y=exp(i*pi*0.75)</FONT>
<P>
<FONT COLOR=#FF0000>y =</FONT>
<P>
<FONT COLOR=#FF0000>-0.7071 + 0.7071i<BR>
</FONT>
<P>
和复数有关的图以极座标来表示会比一般的卡氏座标要合适,<FONT COLOR=#FF0000>polar</FONT>指令可以将数据以极座标方式加以绘图,
其语法为 <FONT COLOR=#FF0000>polar(theta,r)</FONT>,<FONT COLOR=#FF0000>(theta,r)</FONT>分别代表极座标上的角度及半径值。以下的例子说明了 <FONT COLOR=#FF0000>polar</FONT>用法:
<P>
<FONT COLOR=#FF0000>>> t=0:0.01:2*pi;</FONT>
<P>
<FONT COLOR=#FF0000>>> r=sin(2*t).*cos(2*t);</FONT>
<P>
<FONT COLOR=#FF0000>>> polar(t,r)</FONT>
<P>
<FONT COLOR=#FF0000>>> title('Polar plot of sin(2t)cos(2t)')
<BR>
</FONT>
<P>
<FONT COLOR=#FF0000>>> angle=0:2*pi/100:2*pi;</FONT>
<P>
<FONT COLOR=#FF0000>>> r=angle/(2*pi);</FONT>
<P>
<FONT COLOR=#FF0000>>> polar(angle,r)</FONT>
<P>
<FONT COLOR=#FF0000>>> title('Polar plot')</FONT>
<P>
<FONT COLOR=#FF0000>>> grid<BR>
</FONT><HR>
<A HREF="ch4_1_2.htm" tppabs="http://166.111.167.223/computer/cai/matlabjc/ch4_1_2.htm"><IMG SRC="lastpage.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img/lastpage.gif" BORDER=0></A>
<A HREF="ch4_1_4.htm" tppabs="http://166.111.167.223/computer/cai/matlabjc/ch4_1_4.htm"><IMG SRC="nextpage-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img/nextpage.gif" BORDER=0 HSPACE=10></A>
<A HREF="index.html" tppabs="http://166.111.167.223/computer/cai/matlabjc/index.html"><IMG SRC="outline-1.gif" tppabs="http://166.111.167.223/computer/cai/matlabjc/img/outline.gif" BORDER=0 HSPACE=6></A><BR>
<FONT SIZE=2 COLOR=#AA55FF> 上一页 下一页 讲义大纲 </FONT>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -