0% found this document useful (0 votes)
32 views9 pages

Ejercicio 2: A) A (5 4 0 0 - 2 1 0) Derivada Polyder (A)

The document contains examples of using MATLAB to perform operations on matrices and vectors including calculating derivatives and integrals of polynomials, finding the determinant and inverse of a matrix, transposing a matrix, concatenating matrices of zeros and ones, and fitting a polynomial to data using polyfit. Various matrices and vectors are defined and manipulated to demonstrate these MATLAB functions and operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views9 pages

Ejercicio 2: A) A (5 4 0 0 - 2 1 0) Derivada Polyder (A)

The document contains examples of using MATLAB to perform operations on matrices and vectors including calculating derivatives and integrals of polynomials, finding the determinant and inverse of a matrix, transposing a matrix, concatenating matrices of zeros and ones, and fitting a polynomial to data using polyfit. Various matrices and vectors are defined and manipulated to demonstrate these MATLAB functions and operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Ejercicio 2

a)
>> a=[5 4 0 0 -2 1 0];
>> derivada=polyder(a)

derivada =

30 20 0 0 -4 1
b)
>> I=[5 4 0 0 -2 1 0];
>> integral=polyint(I)

integral =

0.7143 0.6667 0 0 -0.6667 0.5000 0 0


Ejercicio 3

>> A=[1 -3 4 -2 0;-1 1 0 -2 -1;2 -1 0 3 0;-2 -1 2 3 1;0 2 1 -1 2]

A=

1 -3 4 -2 0
-1 1 0 -2 -1
2 -1 0 3 0
-2 -1 2 3 1
0 2 1 -1 2
1) >> det(A)

ans =

-208
2) >> inv(A)

ans =

0.0625 0.0625 0.3125 -0.1875 0.1250


-0.0913 0.6010 0.3894 0.0433 0.2788
0.1298 0.5144 0.3413 0.1490 0.1827
-0.0721 0.1587 0.2548 0.1394 0.0096
-0.0096 -0.7788 -0.4327 -0.0481 0.1346
3) >> A'
ans =

1 -1 2 -2 0
-3 1 -1 -1 2
4 0 0 2 1
-2 -2 3 3 -1
0 -1 0 1 2

Ejercicio 5

>> A=ones(4,4)
A=

1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
>> B=[4 4 4 4;4 4 4 4;4 4 4 4;4 4 4 4]

B=

4 4 4 4
4 4 4 4
4 4 4 4
4 4 4 4
>> C=zeros(4,3)

C=

0 0 0
0 0 0
0 0 0
0 0 0

>> a=[A,C]

a=

1 1 1 1 0 0 0
1 1 1 1 0 0 0
1 1 1 1 0 0 0
1 1 1 1 0 0 0
>> B(2,:)=[]

B=

4 4 4 4
4 4 4 4
4 4 4 4

>> B(:,4)=[]

B=

4 4 4
4 4 4
4 4 4
>> D=zeros(3,4)

D=

0 0 0 0
0 0 0 0
0 0 0 0
>> b=[D,B]

b=

0 0 0 0 4 4 4
0 0 0 0 4 4 4
0 0 0 0 4 4 4
>> a(5:7,:)=[b]

a=

1 1 1 1 0 0 0
1 1 1 1 0 0 0
1 1 1 1 0 0 0
1 1 1 1 0 0 0
0 0 0 0 4 4 4
0 0 0 0 4 4 4
0 0 0 0 4 4 4
Ejercicio 4

>> M=[1 2 3 4 5 6 7;8 9 10 11 12 13 14;15 16 17 18 19 20 21;22 23 24 25 26 27 28;29


30 31 32 33 34 35]

M=

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35

>> >> N=M([2:4],[3:6])

N=

10 11 12 13
17 18 19 20
24 25 26 27
Ejercicio 1

>> z=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
34 35 36 37 38 39 40 41 42 43 44 45];

>> x=[55 0 0 0 0 0 0 0 0 0 0 393 0 0 0 0 0 0 0 0 0 0 931 0 0 0 0 0 0 0 0 0 0 2741 0 0 0 0 0 0 0 0 0 0


2292];

>> polyfit(x,z,6)

ans =

1.0e+11 *

-0.0000 0.0000 -0.0000 0.0002 -0.0508 2.2462 0.0000

>> poly2sym(polyfit(x,z,6))

ans =
- (8193691858366249*x^6)/4611686018427387904 +
(1603331060663731*x^5)/140737488355328 - (417004500350751*x^4)/17179869184 +
(5194547714141693*x^3)/268435456 - (2661689620409155*x^2)/524288 +
(7360348887556265*x)/32768 + 6627851970660187/281474976710656

You might also like