sabado 12 de abril

9
Clase del sábado 12 de abril de 2014 % Números comlejos % Números complejos 6+5i ans = 6.0000 + 5.0000i 6+5j ans = 6.0000 + 5.0000i 6+5*i ans = 41 % Variables lógicas A = true A = 1 B = false B = 0 C = A & B C = 0 % o D = A | B D = 1

Upload: brian-williams

Post on 08-Dec-2015

215 views

Category:

Documents


3 download

DESCRIPTION

domingo

TRANSCRIPT

Page 1: Sabado 12 de Abril

Clase del sábado 12 de abril de 2014

% Números comlejos % Números complejos6+5ians =   6.0000 + 5.0000i6+5jans =   6.0000 + 5.0000i6+5*ians =    41% Variables lógicasA = trueA =     1B = falseB =     0C = A & BC =     0% oD = A | BD =     1E= ~A | BE =     0% EjemplopH = [4 6 1 7 9 12 5 3 7 6 14 13 5 2]

Page 2: Sabado 12 de Abril

pH =  Columns 1 through 8     4     6     1     7     9    12     5     3  Columns 9 through 14     7     6    14    13     5     2% ¿Cuántos valores de pH ácido hay en el vector?x = pH < 7x =  Columns 1 through 9     1     1     1     0     0     0     1     1     0  Columns 10 through 14     1     0     0     1     1sum(x)ans =     8% ¿Cuántos valores de pH básico hay en el vector?% ¿Cuántos valores de pH neutro hay en el vector?% ¿Cuántos valores de 3 < pH <=9  hay en el vector?y = pH > 3 & pH <= 9y =  Columns 1 through 9     1     1     0     1     1     0     1     0     1  Columns 10 through 14     1     0     0     1     0sum(y)ans =     8

Page 3: Sabado 12 de Abril

% ERROR:y = 3 > pH <= 9y =  Columns 1 through 9     1     1     1     1     1     1     1     1     1  Columns 10 through 14     1     1     1     1     1y = 3 < pH <= 9y =  Columns 1 through 9     1     1     1     1     1     1     1     1     1  Columns 10 through 14     1     1     1     1     1y = pH > 3 & pH <= 9    % OKy =  Columns 1 through 9     1     1     0     1     1     0     1     0     1  Columns 10 through 14     1     0     0     1     0y = (pH > 3) & (pH <= 9)    % OKy =  Columns 1 through 9     1     1     0     1     1     0     1     0     1  Columns 10 through 14     1     0     0     1     0pHpH =  Columns 1 through 9     4     6     1     7     9    12     5     3     7  Columns 10 through 14     6    14    13     5     2

Page 4: Sabado 12 de Abril

z=pH.*yz =  Columns 1 through 9     4     6     0     7     9     0     5     0     7  Columns 10 through 14     6     0     0     5     0sum(z)ans =    4949/8ans =    6.1250mean(z)ans =    3.5000z = nonzeros(z)z =     4     6     7     9     5     7     6     5mean(z)ans =    6.1250-----------------------------------------------------------------% Conversión de grados Celsius a Fahrenheitclc

Page 5: Sabado 12 de Abril

clear alldisp('Programa de Conversión de grados Celsius a Fahrenheit')celsius = input('Ingrese una temperatura en grados Celsius:');fahrenheit = 9/5*celsius + 32;disp('La temperatura en grados Fahrenheit es')disp(fahrenheit)-----------------------------------------------------------------

Programa de Conversión de grados Celsius a FahrenheitIngrese una temperatura en grados Celsius:100La temperatura en grados Fahrenheit es   212-----------------------------------------------------------------% Definición de funciones en línea. inlinef = inline('1/x - (x-1)')f =     Inline function:     f(x) = 1/x - (x-1)ezplot(f)f(5)ans =   -3.8000f(5)ans =   -3.8000f(0)ans =   Inf

Page 6: Sabado 12 de Abril

fzero(f,5)ans =    1.6180f(ans)ans =  -1.1102e-16fzero(f,-5)ans =   -0.6180f(ans)ans =     0g = inline('x^2 + y^2')g =     Inline function:     g(x,y) = x^2 + y^2g(3,4)ans =    25ezplot(g)g = inline('x^2 + y^2 - 25')g =     Inline function:     g(x,y) = x^2 + y^2 - 25ezplot(g)h = @(x) x^3 - x*sin(x)^2h =     @(x)x^3-x*sin(x)^2h = @(x) x.^3 - x.*sin(x).^2h =     @(x)x.^3-x.*sin(x).^2

Page 7: Sabado 12 de Abril

ezplot(h)clch = @(x) x.^3 - x.*sin(x).^2h =     @(x)x.^3-x.*sin(x).^2ezplot(h)v = @(x,y) x.^3 - x.*sin(y).^2v =     @(x,y)x.^3-x.*sin(y).^2ezplot(v)ezplot(v)5/6*4ans =    3.33335/(6*4)ans =    0.2083(5/6)*4ans =    3.3333diary off