18.04.2013 Views

Dicas de utilização do MATLAB - Programa de Engenharia Química ...

Dicas de utilização do MATLAB - Programa de Engenharia Química ...

Dicas de utilização do MATLAB - Programa de Engenharia Química ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>MATLAB</strong> – PEQ/COPPE/UFRJ- Janeiro <strong>de</strong> 2003<br />

costa@peq.coppe.ufrj.br<br />

Tabela 3.4.1: Coman<strong>do</strong>s úteis <strong>de</strong> manipulação matricial utiliza<strong>do</strong>s pelo <strong>MATLAB</strong>.<br />

Função Significa<strong>do</strong> Exemplo<br />

1<br />

Consi<strong>de</strong>re em to<strong>do</strong>s os exemplos: A <br />

3<br />

2<br />

; r =1.<br />

4<br />

A(r,:) Fornece a submatriz <strong>de</strong> A cujas linhas são <strong>de</strong>finidas pelo » A(r,:)<br />

vetor r e que inclui todas as colunas.<br />

ans =<br />

1 2<br />

A(:,r) Fornece a submatriz <strong>de</strong> A cujas colunas são <strong>de</strong>finidas pelo » A(:,r)<br />

vetor r e que inclui todas as linhas.<br />

ans =<br />

1<br />

3<br />

A(:) Fornece to<strong>do</strong>s os elementos <strong>de</strong> A em um vetor coluna, » A(:)<br />

percorren<strong>do</strong> as colunas <strong>de</strong> A pela or<strong>de</strong>m crescente <strong>de</strong> ans =<br />

seus índices<br />

1<br />

3<br />

2<br />

4<br />

3.5. Comparan<strong>do</strong> vetores e matrizes<br />

Os coman<strong>do</strong>s mais utiliza<strong>do</strong>s para comparação entre vetores e matrizes são<br />

lista<strong>do</strong>s na Tabela 3.5.1.<br />

Tabela 3.5.1: Coman<strong>do</strong>s úteis <strong>de</strong> comparação entre vetores e matrizes.<br />

Função Significa<strong>do</strong> Exemplo<br />

1<br />

Consi<strong>de</strong>re em to<strong>do</strong>s os exemplos: A <br />

3<br />

2<br />

1<br />

; B <br />

4<br />

<br />

5<br />

6<br />

1<br />

; C <br />

2<br />

<br />

3<br />

2<br />

4<br />

<br />

<br />

isequal(A,B) Variável lógica: verda<strong>de</strong>ira se A e B são idênticos. » isequal(A,B)<br />

ans =<br />

0<br />

» isequal(A,C)<br />

ans =<br />

1<br />

»<br />

ismember(A,B) Variável lógica: verda<strong>de</strong>ira quan<strong>do</strong> os elementos » ismember(A,B)<br />

<strong>de</strong> A são também elementos <strong>de</strong> B. ans =<br />

1 1<br />

0 0<br />

» ismember(A,C)<br />

ans =<br />

1 1<br />

1 1<br />

»<br />

12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!