--> // Programación SCILAB
--> //Suma
--> x=3.5;
--> y=x+2.8
y =
6.3
--> //Resta
--> x=2.45;
--> y=x-1.25
y =
1.2
--> //Multiplicacion
--> x=3.82;
--> y=2.34*x+2.5
y =
11.4388
--> //Division
--> x=6.54;
--> y=x/8.34
y =
0.7841727
--> //Potenciacion
--> x=2.46;
--> y=x^3
y =
14.886936
--> //Raiz Cuadrada
--> x=45.68;
--> y=sqrt(x)
y =
6.7586981
--> //Ejercicio
--> x=3.28;
--> y=x^3*(2*x^2+3.56*x-5.21)/sqrt(3*x+2.3)
y =
283.41039
--> // Numeros Complejos
--> z=1.76+3.85*%i
z =
1.76 + 3.85i
--> real(z)
ans =
1.76
--> imag(z)
ans =
3.85
--> // Conjugado de un numero complejo
--> z=4.5+3.8*%i
z =
4.5 + 3.8i
--> zc=conj(z)
zc =
4.5 - 3.8i
--> //Operaciones con numeros complejos
--> z1=2.3+4.8*%i;
--> z2=4.5-7.2*%i;
--> //suma de numeros complejos
--> suma=z1+z2
suma =
6.8 - 2.4i
--> //resta de numeros complejos
--> resta=z1-z2
resta =
-2.2 + 12.i
--> //multiplicacion de numeros complejos
--> mult=z1*z2
mult =
44.91 + 5.04i
--> //division de numeros complejos
--> div=z1/z2
div =
-0.3358302 + 0.5293383i
--> // 2. Funciones Matematicas
--> // Funcion exponencial
--> x=2.78;
--> y=2.3*exp(1.8*x)
y =
342.7184
--> //Logaritmo natural
--> x=35.8;
--> y=3.6*log(x)
y =
12.880612
--> //Logaritmo decimal
--> x=123.89;
--> y=log10(x)
y =
2.0930363
--> // Funciones Trigonometricas
--> // pasar a radianes 45 grados
--> a=45;
--> r=a*%pi/180
r =
0.7853982
--> //calcular seno
--> sin(r)
ans =
0.7071068
--> //calcular coseno
--> cos(r)
ans =
0.7071068
--> //calcular tangente
--> tan(r)
ans =
1.
--> // Encontrar el cateto a
--> // valores conocidos
--> b=4.5;
--> c=8.3;
--> a=sqrt(c^2-b^2)
a =
6.9742383
--> //calculo del angulo
--> beta=asin(b/c)
beta =
0.5730159
--> //pasar valor a grados
--> ang=beta*180/%pi
ang =
32.831392
--> // Evaluacion de una Funcion
--> //valores de las variables
--> x=2.5;
--> y=3.2;
--> f=sin(2*x)-2*cos(y)+sqrt(3^x)
f =
4.9858873
--> // Soluciones de Ecuaciones
--> //hallar las raices de x^2+3x+2=0
--> p=[1 3 2];
--> raices=roots(p)
raices =
-2.
-1.
--> //encontrar las raices de 2x3-4x+3=0
--> p=[2 0 -4 3];
--> r=roots(p)
r =
-1.6980481
0.849024 + 0.4031444i
0.849024 - 0.4031444i
--> // Vectores y Raices
--> //vector fila
--> A=[1 3 2 6 -1]
A =
1. 3. 2. 6. -1.
--> //vector columna
--> A=[1;3;2;6;-1]
A =
1.
3.
2.
6.
-1.
--> // Operaciones con Vectorea
--> Suma y resta
Undefined variable: Suma
--> //suma y resta
--> A=[2 1 3 4];
--> B=[-1 3 2 2];
--> C= A+B
C =
1. 4. 5. 6.
--> D=A-B
D =
3. -2. 1. 2.
--> //multiplicacion por un escalar
--> A=[2 3 1 5];
--> 5*A
ans =
10. 15. 5. 25.
--> // Matrices
--> [-1 2 5 3;2 1 0 2;2 -2 3 -3]
ans =
-1. 2. 5. 3.
2. 1. 0. 2.
2. -2. 3. -3.
--> //operaciones con matrices
--> A=[2 1 -1;0 2 3 ;1 -1 2];
--> B=[1 3 0;2 1 3;2 3 1];
--> S=A+B
S =
3. 4. -1.
2. 3. 6.
3. 2. 3.
--> R =A-B
R =
1. -2. -1.
-2. 1. 0.
-1. -4. 1.
--> //Multiplicaion por un escalar
--> M=[1 2 1;2 -1 3;4 1 0];
--> N=5M
N=5M
^^
Error: syntax error, unexpected identifier, expecting end of file
--> N=5*M
N =
5. 10. 5.
10. -5. 15.
20. 5. 0.
--> // Multiplicacion de Matrices
--> A=[1 2 2;2 3 1];
--> B=[2 1;3 1;2 1];
--> M=A*B
M =
12. 5.
15. 6.
--> // Matriz Transpuesta
--> A=[2 1 -1;0 2 3;1 -1 2]
A =
2. 1. -1.
0. 2. 3.
1. -1. 2.
--> A'
ans =
2. 0. 1.
1. 2. -1.
-1. 3. 2.
--> // Determinante de un matriz
--> A=[2 1 -1;0 2 3;1 -1 2]
A =
2. 1. -1.
0. 2. 3.
1. -1. 2.
--> det(A)
ans =
19.
--> //Matriz Inversa
--> A= [2 1 -1;0 2 3;1 -1 2]
A =
2. 1. -1.
0. 2. 3.
1. -1. 2.
--> inv(A)
ans =
0.3684211 -0.0526316 0.2631579
0.1578947 0.2631579 -0.3157895
-0.1052632 0.1578947 0.2105263
--> // Soluciones de Ecuaciones
--> A= [2 1 -2;3 2 2;5 4 3]
A =
2. 1. -2.
3. 2. 2.
5. 4. 3.
--> b=[-10;-1;-4]
b =
-10.
-1.
-4.
--> [x]=linsolve(A,b)
x =
1.
2.
-3.
--> // Graficacion
--> //graficar la funcion seno de 0 a 2pi
--> x=[0:0.1:2*%pi];
--> y=sin(x);
--> plot(x,y)
--> xgrid
Figura guardada.
--> //graficar dos figuras
--> plot(x,sin(x),x,cos(x));
--> xgrid
--> // Parametros
--> clf
--> t=0:1:10;
--> x=1.5*t+1.8;
--> y=0.08*t^2;
--> plot(t,x,'r-',t,y,'g-.')
--> xgrid
--> xtitle('GRAFICADE LA RECTA Y PARABOLA','SEGUNDOS','LONGITUD')
--> // Subgraficas
--> clf
--> x=[0:0.1:10];
--> subplot(221)
--> y1=2*x+1;
--> plot(x,y1)
--> subplot(222)
--> y2=0.2*x^2;
--> plot(x,y2)
--> subplot(223)
--> y3=15*sin(x);
--> plot(x,y3)
--> subplot(224)
--> y4=15*cos(x);
--> plot(x,y4)
--> xgrid(4)
Figura guardada.
--> // Comando plot2d
--> clf
--> x=[-20:0.1:20];
--> y=0.3*x^2-5;
--> plot2d(x,y)
--> xgrid
Figura guardada.
--> //Vector por matriz
--> clf
--> t=[-2:0.01:2];
--> f=2*t^2+2;
--> g=2*t+3;
--> plot2d(t,[f'g'])
--> //colocar colores, leyenda y limites a ejes
--> clf
--> plot2d(t,[f'g'],[2 4],leg="RECTA@PARABOLA")
--> plot2d(t,[f'g'],[3 4],leg="PARABOLA@RECTA",rect=[-1 -1 3 5])
--> xgrid
Figura guardada.
--> //Cambiar de escala y a logaritmica
--> clf
--> x=[0.1:0.1:10];
--> y=x^2+2*x^3;
--> xgrid
--> plot2d(x,y,3,logflag="ln")
Figura guardada.
--> //COMANDO plot3d
--> clf
--> x=-5:0.1:5;
--> y=-5:0.1:5;
--> z=y'*(x^2);
--> plot3d(x,y,z)
Figura guardada.
--> // 5. Derivadas e Integrales
--> //Derivadas de polinomios
--> x=poly(0,'x');
--> y=x^2;
--> derivat(y)
ans =
2x
--> //otro ejemplo
--> y=(2*x^2)/(2+x^3);
--> dyt=derivat(y)
dyt =
8x - 2x
-----------
3 6
4 + 4x + x
--> //Integral definida
--> function y=f(x)
> y=x^2
> endfunction
--> intg(1,2,f)
ans =
2.3333333
--> //Ejemplo plot señal aleatoria
--> clf
--> t=1:1:50;
--> y=rand(1,50);
--> plot(t,y);
--> a=gca();
--> a.x_label.text="time";
--> a.y_label.text="amplitude";
Figura guardada.
--> clf
--> m=rand(5,7);
--> i=1:1:5;
--> j=1:1:7;
--> plot3d(i,j,m);
Figura guardada.