Sunteți pe pagina 1din 10

MATLAB

1) Evaluar
la
operaciones
de
adicin,
multiplicacin,
divisin, hallar las races,
polinomios (poner los ejemplos).
ADICIN
>> 24+51
ans =
75
MULTIPLICACIN
>> 2*254
ans =
508
DIVISIN
>> 158/25
ans =
6.3200
POLINOMIOS Y RAICES
>> p1=[20 15 30 65 8]
p1 =

20

15

30

>> r1=roots(p1)
r1 =
0.3473 + 1.4871i
0.3473 - 1.4871i
-1.3142 + 0.0000i
-0.1305 + 0.0000i

65

2)
Crear la Funcin fun_xa que evalue la
serie
f(x) = 1 + x + x^2/2! + x^3/3! + +x^n/n!
EN EDITOR CREANDO FUNCION func_xa.m
function [b,h,ser]=fun_xa(x,n)
h=1;
for b=drange(1:n)
h=h+((x.^b)/factorial(b));
end
h
pause

3) Crear
una
funcin
para
hallar
la
impedancia de un ckto. serie RLC serie,
datos R,L,C y W
EN EDITOR CREANDO FUNCION RLC.m
function [ Z, Fas ] = RLC(R,L,C,W)
XC=1/(W*C);
XL=W*L;
Z=sqrt(R^2 + (XL-XC)^2);

Fas=atan((XL-XC)/R);
end

4) Poner
ejemplos
bidimensionales

de

grficos

Ejemplo1.
>> t=0:2:300;
>> x=(t-25).^4;
>> plot(t,x,'o');

Ejemplo2.
>> t=0:0.8:400;
>> y=tan((2*t)/20);
>> plot(t,y,'o');

5) Poner
ejemplos
tridimensionales

de

grficos

Ejemplo1.
>> t=0:0.2:20;
>> x=cos(t*pi);
>> y=sin(3*t*pi);
>> plot3(t,x,y,'o')

Ejemplo2.
>> z = [ 1 2 3 4 5 6 7 8 9 10; 2 4 6 8 10 12 14 16 18 20 ;
3 4 5 6 7 8 9 10 11 12] ;
>> mesh(z)

6)

Poner ejemplos de operaciones vectoriales

>> t=3:2:9
t=
3

>> q=10:5:25
q=
10

15

20

25

>> y= t*2+q/5
y=
8

13

18

23

>> z=t'*2*q.^2

z=
600

1350

2400

3750

1000

2250

4000

6250

1400

3150

5600

8750

1800

4050

7200

11250

7)

Poner ejemplo de operaciones matriciales.

>> A=[1 2 3;4 5 6;7 8 9]


A=
1

>> B=zeros(3,5)
B=
0

>> C=10*rand(5)
C=
8.1472

0.9754

1.5761

1.4189

6.5574

9.0579

2.7850

9.7059

4.2176

0.3571

1.2699

5.4688

9.5717

9.1574

8.4913

9.1338

9.5751

4.8538

7.9221

9.3399

6.3236

9.6489

8.0028

9.5949

6.7874

>> F=diag([1,2,3,4,5],-1)
F=
0

>> D=floor(C)

D=
8

>> g=inv(A)
Warning: Matrix is close to singular or badly
scaled. Results may be inaccurate. RCOND =
1.541976e-18.
g=
1.0e+16 *

-0.4504

0.9007 -0.4504

0.9007 -1.8014
-0.4504

0.9007

0.9007 -0.4504

S-ar putea să vă placă și