佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 2707|回复: 34

学过MATLAB的请进来。。

[复制链接]
发表于 27-5-2005 03:47 AM | 显示全部楼层 |阅读模式
对于MATLAB,你们有什么看法?
回复

使用道具 举报


ADVERTISEMENT

发表于 27-5-2005 06:40 PM | 显示全部楼层
没用过。
请问怎样用?
看起来好像很好用这样。
回复

使用道具 举报

 楼主| 发表于 29-5-2005 08:55 PM | 显示全部楼层
其实matlab是好像programing一样,是用program来solve数学题(应该可以酱讲吧。。)
这里就放一些basic的给你看。。由于很多时候我们一考完试,就会忘掉之前学的,所以暂时放一些basic的给你看。。迟点我再放一些advance的,也希望大家可以进来分享,尤其是那些有用过的,这样才可以让初学者更了解,因为我也想学更多。。谢谢

回复

使用道具 举报

发表于 30-5-2005 01:16 AM | 显示全部楼层
嗯。。。。有兴趣学。 不如你来教教几招把, 和大家分享分享一下 。
会的人也来交流交流一下。 呵呵。
回复

使用道具 举报

发表于 2-6-2005 01:36 AM | 显示全部楼层
我有学过,皮毛而已。。。我觉得Matlab用来解决工程方面的问题是非常好的,其它方面就没那么好了。。。
回复

使用道具 举报

 楼主| 发表于 2-6-2005 03:36 AM | 显示全部楼层
可以分享你所学的吗?
回复

使用道具 举报

Follow Us
发表于 2-6-2005 06:47 PM | 显示全部楼层
DeadCow 于 2-6-2005 03:36 AM  说 :
可以分享你所学的吗?


分享?呵呵。。。熊猫表达能力不好,不然你继续分享,然后熊猫再看看有什么可以补充,这样比较好,才不会误人子弟。
回复

使用道具 举报

 楼主| 发表于 2-6-2005 08:18 PM | 显示全部楼层
我也是学皮毛吧了。。
回复

使用道具 举报


ADVERTISEMENT

Memphisto 该用户已被删除
发表于 4-6-2005 09:45 PM | 显示全部楼层
MATLAB 是一个非常强大的工具。它好比进化版的FORTRAN,可以应用在很多的工程算数,及复杂的应用程序。我只在大学学了一点皮毛(一个semester),已经让我爱上了Programming,任为MATLAB无可不能,能人之不能 :)
基本上它是用matrix来program的,用户需要利用matrix来编程。。。 我开始不能接受这种奇怪的编程,可是用惯了后,就欲摆不能了,任为C-PROG,Q-Basic等等太麻烦了。但是MATLAB的troubleshooting Debugging还是逊色于C-PROG,可能是小弟的程度底吧。。。。

有人就用MATLAB来program指纹核对这种精密的application.无奈公司没有MATLAB,我只好黄飞鸿收档。。。。
回复

使用道具 举报

Memphisto 该用户已被删除
发表于 4-6-2005 09:49 PM | 显示全部楼层
BTW,我也是皮毛而已。。。。只是开心这里有人会MATLAB。具我所知,本地只有私立大专有教哦。。。。
回复

使用道具 举报

 楼主| 发表于 5-6-2005 12:16 AM | 显示全部楼层
我是本地大学的--upm。。
我是读物理的,里面有一科是教matlab的,我们还在这个subject学agilent vee
回复

使用道具 举报

 楼主| 发表于 5-6-2005 12:18 AM | 显示全部楼层
很高兴有人知道这个software,可以分享你所学的吗?因为我觉得这个software蛮利害的
回复

使用道具 举报

 楼主| 发表于 5-6-2005 12:42 AM | 显示全部楼层
其实matlab是可以做很多东西的,比如说graph。。不过考完试后,就忘了很多,所以这次只好分享一些书上的(抄出来)。。迟些会分享其他我所学或未曾学的。。也希望大家可以分享自己所学的matlab,因为本人学的只是皮毛。

回复

使用道具 举报

 楼主| 发表于 5-6-2005 01:08 AM | 显示全部楼层
MATLAB也可以画很多3D的图画。。我没学过。。但看到书上有,所以便抄出来。。

MATLAB program demonstrating parametric surfaces:
回复

使用道具 举报

 楼主| 发表于 5-6-2005 01:11 AM | 显示全部楼层
回复

使用道具 举报

发表于 5-6-2005 10:37 AM | 显示全部楼层
哦...

我也学过皮毛而已...

我们主要用来画GRAPH
它画出来比EXCEL美丽很多
而且TREND LINE也叫多种...

我最近是用来做CONTROL SYSTEM的BODE PLOT


另外,它还可以用来画BLOCK DIAGRAM
每个BLOCK里都有写好的FORMULA(如:FEEDBACK LOOP)

听说我学校的LECTURER也有份开发MATLAB了
不懂是不是真的
回复

使用道具 举报


ADVERTISEMENT

Memphisto 该用户已被删除
发表于 5-6-2005 05:44 PM | 显示全部楼层
MATLAB有一个强大的toolbox,可以用来做很多东西,省了很多工夫。我的朋友就用toolbox来做她的Final year project,模拟robotic arm. 不好意思,公司没有MATLAB,不可以分享我的MATLAB程序。 有时上网看看其他MATLAB用户的网站,真的觉的MATLAB太伟了,而自己知道的太少太少了。
回复

使用道具 举报

 楼主| 发表于 5-6-2005 08:31 PM | 显示全部楼层
你们是在那里学的?还有楼上一个说你们letcurer有份参与研发matlab?你是读什么学校的?matlab的确是可以画出一些很美的graph或图画。。
你们说你们学的是皮毛,不过觉得你们学的好像很"advance"。。因为我只在学校一个学期的一个subject学过,而且学了半个学期,就学agilent vee了。。

希望你们可以放一些简单/复杂(总之是matlab就可以了)的教学。。

我也打算在final year project用matlab来做一些简单的graph/图画
回复

使用道具 举报

发表于 6-6-2005 06:58 AM | 显示全部楼层
DeadCow 于 5-6-2005 12:31 PM  说 :
你们是在那里学的?还有楼上一个说你们letcurer有份参与研发matlab?你是读什么学校的?matlab的确是可以画出一些很美的graph或图画。。
你们说你们学的是皮毛,不过觉得你们学的好像很"advance"。。因为我只在 ...

我在ASTON UNIVERSITY
听说而已拉...又不懂她有没有酱GENG

我学的也是皮毛,LECTURER也是大概讲解而已...
没有真正去用,试...
回复

使用道具 举报

发表于 6-6-2005 07:00 AM | 显示全部楼层

设定方程式

Defining Transfer Functions in Matlab

There are two forms of transfer function representation in Matlab. The most obvious is the polynomial form where
G(s) =         b(s) a(s)
        =         s2 + 2 s + 3 s3 + 4 s2 + 5 s + 6
       
is entered as two row vectors with the polynomial coefficients entered in the order of ascending powers of s.

>> b = [1, 2, 3];
>> a = [1, 4, 5, 6];

Missing coefficients, must be entered as zero: so q(s) = s2 + 2s and r(s) = s4 + s2 + 1 are entered as

>> q = [1, 2, 0];
>> r = [1, 0, 2, 0, 1];

An alternative form of representation for transfer functions is the factored polynomial, for example
G(s) =         (s + 1)(s + 3) s(s + 2)(s + 4)
       
The advantage of this formulation is that the zeros of the numerator and denominator polynomials are obvious by inspection. So it is often used in the preliminary analysis of the performance of a dynamic system. The poles of this transfer function are s = 0, -2, -4 and the zeros are s = -1, -3. In Matlab, this form of transfer function is specified by a column vector of the zeros and a column vector of the poles:

>> z = [-1; -3];
>> p = [0; -2; -4];

A third parameter, the overall gain K, completes the definition of the so called pole-zero-gain form of transfer function. In this case K = 1

>> K = 1;

The Linear Time Invariant System Object
Starting from version 4 of the Control System Toolbox (distributed with Matlab version 5), the Mathworks have introduced a new data object for the creation and manipulation of system transfer functions. This object is called the Linear Time Invariant (LTI) System Object. It is used to gather the components of a transfer function (or state-space model) into a single variable which can then easily be combined with other LTI system objects.

To create a LTI system object representing a factored transfer function the following command is issued:

>> G = zpk(z,p,K)

Zero/pole/gain:
  (s+1) (s+3)
-------------
s (s+2) (s+4)

The expanded numerator and denominator form of the transfer function is readily obtained by using a ``data extraction'' function.

>> [num,den]=tfdata(G,'v')

num =

      0     1     4     3


den =

      1     6     8     0

LTI system objects can also be created from the expanded form of a transfer function directly:

>> G2=tf(num,den)

Transfer function:
   s^2 + 4 s + 3
-----------------
s^3 + 6 s^2 + 8 s

and the zeros and poles similarly extracted:

>> [zeros,poles,gain]=zpkdata(G2,'v')

zeros =

     -3
     -1

poles =

      0
     -4
     -2

gain =

      1

Setting LTI Properties
Numerous options are available to document the LTI system objects that you create. For example, suppose the transfer function G represents a servomechanism with input ``Voltage'' and output ``Angular Position''. We can add this information to the LTI system as follows:

>> set(G,'inputname','Voltage','ouputname','Angular Position')
>> G

Zero/pole/gain from input "Voltage" to output "Angular Position":
  (s+1) (s+3)
-------------
s (s+2) (s+4)

Such documentary information is probably best added when the LTI system object is created, for example as:

>> G3=zpk(z,p,K,'inputname','Armature Voltage (V)',...
               'outputname','Load Shaft Position (rad)',...
               'notes','An armature voltage controlled servomechanism')

Zero/pole/gain from input "Armature Voltage (V)"
to output "Load Shaft Position (rad)":
  (s+1) (s+3)
-------------
s (s+2) (s+4)

Once the LTI object has been documented, the documentation can be extracted using commands like:

>> get(G3,'notes')

ans =

     'An armature voltage controlled servomechanism'

One can also access the documentation using an ``object reference'' notation

>> in=G3.inputname, out=G3.outputname

in =

     'Armature Voltage (V)'


out =

     'Load Shaft Position (rad)'

All the documentation available on an LTI system object may be extracted with a single command:

>> get(G3)
         z = {1x1 cell}
         p = {1x1 cell}
         k = 1
         Variable = 's'
         Ts = 0
         Td = 0
         InputName = {'Armature Voltage (V)'}
         OutputName = {'Load Shaft Position (rad)'}
         Notes = {[1x45 char]}
         UserData = []

There are numerous other documentation features provided for LTI system objects. Please consult the on-line help for full details.

System Transformations
Matlab supports the easy transformation of LTI system objects between expanded and factored forms1. For example to convert a transfer function from `expanded' form to pole-zero-gain form the following command is used:

>> G4 = zpk(G2)

Transfer function:
   s^2 + 4 s + 3
-----------------
s^3 + 6 s^2 + 8 s

To convert from zero-pole-gain form to expanded form we use the function tf:

>> G5 = tf(G)

Transfer function from input "Voltage" to output "Angular Position":
   s^2 + 4 s + 3
-----------------
s^3 + 6 s^2 + 8 s

Please note that these transformations are merely a convenience that allow you to work with your preferred form of representation. Most of the tools that deal with LTI system objects will work with any form2. Furthermore, you can always use the data extraction functions zpdata and tfdata to extract the zero-pole-gain and numerator-denominator parameters from a LTI system, no matter in which form it was originally defined, without the need for an explicit conversion.

Combining LTI System Objects
A powerful feature of the LTI system object representation is the ease with which LTI objects can be combined. For example, suppose we have two transfer functions
G1(s) =         s+1 s+3
       
and
G2(s) =         10 s(s+2)
       
then the series combination of the two transfer functions Gs(s) = G1(s)G2(s) is obtained using the ``*'' (multiplication) operator:

>> G1=tf([1 1],[1 3]);
>> G2=tf(10,conv([1 0],[1 2])); % conv is polynomial multiplication
>> Gs=G1*G2 % series connection of two sys objects

Transfer function:
     10 s + 10
-----------------
s^3 + 5 s^2 + 6 s

>> [zeros,poles,K]=zpkdata(Gs,'v')

zeros =

     -1


poles =

      0
     -3
     -2


K =

     10

The parallel connection of two LTI system objects corresponds to addition Gp = G1(s)+G2(s):

>> Gp = G1 + G2

Transfer function:
s^3 + 3 s^2 + 12 s + 30
-----------------------
    s^3 + 5 s^2 + 6 s

The feedback connection of two LTI system objects is also supported. The function feedback is used for this. Let
G(s) =         2s2 + 5s +1 s2 + 2s + 3
       
be the forward transfer function of a closed-loop system and
H(s) =         5(s+2) (s+10)
       
be the feedback network. Then the closed-loop transfer function3 is
Gc(s) =         G(s) 1 + G(s)H(s)
        .
In matlab:

>> G = tf([2 5 1],[1 2 3],'inputname','torque',...
                         'outputname','velocity');
>>  H = zpk(-2,-10,5);
>>  Gc = feedback(G,H) % negative feedback assumed

Zero/pole/gain from input "torque" to output "velocity":
0.18182 (s+10) (s+2.281) (s+0.2192)
-----------------------------------
  (s+3.419) (s^2 + 1.763s + 1.064)

The Analysis of LTI System Objects
Matlab uses the LTI system objects as parameters for the analysis tools such as impulse, step, nyquist, bode and rlocus. As an example of their use try:

>> rlocus(G*H) % root locus
>> bode(G*H)% open-loop frequency response
>> step(Gc) % closed-loop step response
>> bode(Gc) % closed-loop frequency response

Matlab also provides two interactive graphical tools that work with LTI system objects.

    * ltiview is a graphical tool that can be used to analyze systems defined by LTI objects. It provides easy access to LTI objects and time and frequency response analysis tools.
    * rltool is an interactive tool for designing controllers using the root locus method.

You are encouraged to experiment with these tools.

Partial Fraction Expansions
Matlab provides a command called residue that returns the partial fraction expansion of a transfer function. That is, given
G(s) =         sm +bm-1sm-1 + ¼+ b1 s + b0 sn + an-1sn-1 + ¼+a1 s + a0
       
it returns
        R1 s + p1
        +         R2 s + p2
        + ¼         Rn s + pn
        + K(s)
where pi are the poles of the transfer function, Ri are the coefficients of the partial fraction terms (called the residues of the poles) and K(s) is a remainder polynomial which is usually empty. To use this, the starting point must (rather perversely) be the expanded form of the transfer function in polynomial form. Thus given
C(s) =         5(s + 2) s(s + 3)(s + 10)
       
we obtain the partial fraction expansion using the Matlab command sequence:

>> k = 5; z = [-2]; p = [0; -3; -10]; % zero-pole-gain form
>> C = zpk(z,p,k);
>> [num,den] = tfdata(C,'v')
num =
      0     0     5    10

den =
      1    13    30     0

(Note that the leading terms in num are zero).

>> [r,p,k] = residue(num,den)
r =
    -0.5714
     0.2381
     0.3333

p =
    -10
     -3
      0

k =
      []

which we interpret to mean
C(s) =         0.3333 s
        +         0.2381 s + 3
        -         0.5714 s + 5
        .
If C(s) represents the step response of the system
G(s) =         5(s + 2) (s + 3)(s + 10)
       
then the step response is, by inspection,
c(t) = 0.3333h(t) + 0.2381 e-3t - 0.5714 e-10t.

You can check this with the command:

>> newC = tf([5, 10],[1, 13, 30])
>> step(newC)

(where the 1/s term has been eliminated because step provides the forcing function itself). This should give exactly the same results as:

t = 0:.05:1.5; % time vector
c = 0.3333 + 0.2381 * exp(-3*t) - 0.5714 * exp(-10*t);
plot(t,c)


(资料是英文的,PAISEH)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 26-11-2024 11:39 PM , Processed in 2.013075 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表