A apresentação está carregando. Por favor, espere

A apresentação está carregando. Por favor, espere

Scilab Aula 2 – Background.

Apresentações semelhantes


Apresentação em tema: "Scilab Aula 2 – Background."— Transcrição da apresentação:

1 Scilab Aula 2 – Background

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

3 Vetores e Matrizes Vetor Linha u = 0:3 = [0 1 2 3 ] Vetor Coluna
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 = X =

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 = mod = b) ang = mod =

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 = re =

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


Carregar ppt "Scilab Aula 2 – Background."

Apresentações semelhantes


Anúncios Google