1 / 14

Scilab

Scilab. Aula 2 – Background. Comandos for, while, if-then-else. for variável = vetor_linha //corpo end while condição // corpo end. If condição then //corpo elseif condição //corpo else //corpo end. Vetores e Matrizes. Vetor Linha u = 0:3 = [0 1 2 3 ] Vetor Coluna

eben
Télécharger la présentation

Scilab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scilab Aula 2 – Background

  2. Comandos for, while, if-then-else for variável = vetor_linha //corpo end while condição // corpo end If condição then //corpo elseif condição //corpo else //corpo end

  3. Vetores e Matrizes Vetor Linha u = 0:3 = [0 1 2 3 ] Vetor Coluna u = [0; 1; 2; 3] ps: ones(1:3), zeros(0:3)

  4. Vetores e Matrizes A = [1 2 3; 4 5 6; 7 8 9 ] B = ones(3,3) C = [A B] D = matrix(C,9,1) diag(A), det(A), eye(m,m), A`, inv(A)

  5. Funções function [varRetorno1, ... , varRetornoN] = nomeDaFuncao(param1, ... , paramN) // corpo da função end function

  6. Matrizes B.31 Considere o seguinte sistema de equações: X1 + x2 + x3 = 1 X1 + 2x2 + 3x3 = 3 X1 – x2 = -3 Utilize a regra de Cramer para determinar x1,x2,x3. X1 = -1 X2 = 2 X3 = 0

  7. Matrizes -->A = [1 -2 3; -sqrt(3) 1 -sqrt(5); 3 -sqrt(7) 1] --> y = [1; π ; e] A = 1. - 2. 3. - 1.7 1. - 2.2 3. - 2.6 1. X = -1.999 -3.8998 -1.5999

  8. Função Exerc1: Definir uma função que converte um número complexo da forma cartesiana para a forma polar e usá-la em: • z = 4 + j * 4 • z = -3 + j * 5 Exerc2: Definir uma função que converte um número complexo da forma polar para forma cartesiana e usá-la em: • z = 4*e-j(3 π /4) • z = 2*ej(π /2)

  9. Exercício 1 -->function [mod,ang] = cart_to_polar(re,im) -->mod = sqrt(re^2 + im^2); -->ang = atan(im/re) * 180/%pi; -->endfunction a) ang = 45. mod = 5.6568542 b) ang = - 59.036243 mod = 5.8309519

  10. Exercicio 2 -->function [re,im] = polar_to_cart(mod, ang) -->re = mod*cos(ang*%pi/180); -->im = mod*sin(ang*%pi/180); -->endfunction b) im = 0 re = 2. a) im = - 2.8284271 re = - 2.8284271

  11. Plot B.21 a) X1(t) = Re(2e(-1+j2 π)t) Pode-se usar: exp(), real()

  12. Plot B.21 b) X2(t) = Im(3 – e(1-2jπ)t) Usar: imag()

  13. Plot B.21 c) X3(t) = 3 – Im(e(1-2 πj)t)

  14. Fim lfcpc@cin.ufpe.br

More Related