亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

matlab中connect函數用法?

matlab中connect函數用法?

眼眸繁星 2019-02-06 14:07:45
matlab中connect函數用法
查看完整描述

2 回答

?
米琪卡哇伊

TA貢獻1998條經驗 獲得超6個贊

 connect()用于建立與指定socket的連接。
  頭文件: #include <winsock.h>
  函數原型: int PASCAL FAR connect( SOCKET s, const struct sockaddr FAR* name, int namelen);
  參數:
  s:標識一個未連接socket
  name:指向要連接套接字的sockaddr結構體的指針
  namelen:sockaddr結構體的字節長度
  注釋:

  本函數用于創建與指定外部端口的連接。s參數指定一個未連接的數據報或流類套接口。如套接口未被捆綁,則系統賦給本地關聯一個唯一的值,且設置套接口為已捆綁。請注意若名字結構中的地址域為全零的話,則connect()將返回WSAEADDRNOTAVAIL錯誤。
  對于流類套接口(SOCK_STREAM類型),利用名字來與一個遠程主機建立連接,一旦套接口調用成功返回,它就能收發數據了。對于數據報類套接口(SOCK_DGRAM類型),則設置成一個缺省的目的地址,并用它來進行后續的send()與recv()調用。
  返回值:

  若無錯誤發生,則connect()返回0。否則的話,返回SOCKET_ERROR錯誤,應用程序可通過WSAGetLastError()獲取相應錯誤代碼。對非阻塞套接口而言,若返回值為SOCKET_ERROR則應用程序調用WSAGetLsatError()。如果它指出錯誤代碼為WSAEWOULDBLOCK,則您的應用程序可以:
  1.用select(),通過檢查套接口是否可寫,來確定連接請求是否完成。
  2.如果您的應用程序使用基于消息的WSAAsynSelect()來表示對連接事件的興趣,則當連接操作完成后,您會收到一個FD_CONNECT消息。
  錯誤代碼

  WSAENOTINITIALISED:在使用此API之前應首先成功地調用WSAStartup()。
  WSAENETDOWN:WINDOWS套接口實現檢測到網絡子系統失效。
  WSAEADDRINUSE:所指的地址已在使用中。
  WSAEINTR:通過一個WSACancelBlockingCall()來取消一個(阻塞的)調用。
  WSAEINPROGRESS:一個阻塞的WINDOWS套接口調用正在運行中。
  WSAEADDRNOTAVAIL:在本地機器上找不到所指的地址。
  WSAENOTSUPPORT:所指族中地址無法與本套接口一起使用。
  WSAECONNREFUSED:連接嘗試被強制拒絕。
  WSAEDESTADDREQ:需要目的地址。
  WSAEFAULT:namelen參數不正確。
  WSAEINVAL:套接口沒有準備好與一地址捆綁。
  WSAEISCONN:套接口早已連接。
  WSAEMFILE:無多余文件描述字。
  WSAENETUNREACH:當前無法從本主機訪問網絡。
  WSAENOBUFS:無可用緩沖區。套接口未被連接。
  WSAENOTSOCK:描述字不是一個套接口。
  WSAETIMEOUT:超時時間到。
  WSAEWOULDBLOCK:套接口設置為非阻塞方式且連接不能立即建立??捎胹elect()調用對套接口寫,因為select()時會進行連接。



查看完整回答
反對 回復 2019-03-15
?
不負相思意

TA貢獻1777條經驗 獲得超10個贊

connect Block-diagram interconnections of dynamic systems.

connect computes an aggregate model for a block diagram interconnection
of dynamic systems. You can specify the block diagram connectivity in
two ways:

Name-based interconnection
In this approach, you name the input and output signals of all blocks
SYS1, SYS2,... in the block diagram, including the summation blocks.
The aggregate model SYS is then built by
SYS = connect(SYS1,SYS2,...,INPUTS,OUTPUTS)
where INPUTS and OUTPUTS are the names of the block diagram external
I/Os (specified as strings or string vectors).

Example 1: Given SISO models C and G, you can construct the closed-loop
transfer T from r to y using

e u
r --->O-->[ C ]---[ G ]-+---> y
- | |
+<----------------+

C.InputName = 'e'; C.OutputName = 'u';
G.InputName = 'u'; G.OutputName = 'y';
Sum = sumblk('e = r-y');
T = connect(G,C,Sum,'r','y')

Example 2: If C and G above are two-input, two-output models instead,
you can form the MIMO transfer T from r to y using
C.u = 'e'; C.y = 'u';
G.u = 'u'; G.y = 'y';
Sum = sumblk('e = r-y',2);
T = connect(G,C,Sum,'r','y')
Note that C.u,C.y is shorthand for C.InputName,C.OutputName and that
'r','y' select all entries of the two-entry vector signals r and y.

Example 3: If you already have specified I/O names for C and G, you
can build the closed-loop model T using:
Sum = sumblk('%e = r - %y',C.u,G.y);
T = connect(G,C,Sum,'r',G.y)
See SUMBLK for more details on using aliases like %e and %y.

Index-based interconnection
In this approach, first combine all system blocks into an aggregate,
unconnected model BLKSYS using APPEND. Then construct a matrix Q
where each row specifies one of the connections or summing junctions
in terms of the input vector U and output vector Y of BLKSYS. For
example, the row [3 2 0 0] indicates that Y(2) feeds into U(3), while
the row [7 2 -15 6] indicates that Y(2) - Y(15) + Y(6) feeds into U(7).
The aggregate model SYS is then obtained by
SYS = connect(BLKSYS,Q,INPUTS,OUTPUTS)
where INPUTS and OUTPUTS are index vectors into U and Y selecting the
block diagram external I/Os.

Example: You can construct the closed-loop model T for the block
diagram above as follows:
BLKSYS = append(C,G);
% U = inputs to C,G. Y = outputs of C,G
% Here Y(1) feeds into U(2) and -Y(2) feeds into U(1)
Q = [2 1; 1 -2];
% External I/Os: r drives U(1) and y is Y(2)
T = connect(BLKSYS,Q,1,2)

Note:
* connect always returns a state-space or FRD model SYS
* States that do not contribute to the I/O transfer from INPUTS to
OUTPUTS are automatically discarded. To prevent this, set the
"Simplify" option to FALSE:
OPT = connectOptions('Simplify',false);
SYS = connect(...,OPT)



查看完整回答
反對 回復 2019-03-15
  • 2 回答
  • 0 關注
  • 815 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號