+ All Categories
Home > Documents > Clase de Compu

Clase de Compu

Date post: 01-Oct-2015
Category:
Upload: efernandoquispesalazar
View: 220 times
Download: 2 times
Share this document with a friend
Description:
c
34
>> p(x)=x^3+2x^2+3x+4 ??? p(x)=x^3+2x^2+3x+4 | Error: Unexpected MATLAB expression. >> %p(x)=x^3+2x^2+3x+4 >> p=[1 2 3 4] p = 1 2 3 4 >> roots(p) ans = -1.6506 -0.1747 + 1.5469i -0.1747 - 1.5469i >> r=(1 1+i 1-i 2] ??? r=(1 1+i 1-i 2] | Error: Unexpected MATLAB expression. >> r=(1 1+i 1-i 2)
Transcript

>> p(x)=x^3+2x^2+3x+4??? p(x)=x^3+2x^2+3x+4 |Error: Unexpected MATLAB expression. >> %p(x)=x^3+2x^2+3x+4>> p=[1 2 3 4]

p =

1 2 3 4

>> roots(p)

ans =

-1.6506 -0.1747 + 1.5469i -0.1747 - 1.5469i

>> r=(1 1+i 1-i 2]??? r=(1 1+i 1-i 2] |Error: Unexpected MATLAB expression. >> r=(1 1+i 1-i 2)??? r=(1 1+i 1-i 2) |Error: Unexpected MATLAB expression. >> r=[1 1+i 1-i 2]

r =

1.0000 1.0000 + 1.0000i 1.0000 - 1.0000i 2.0000

>> poly(r)

ans =

1 -5 10 -10 4

>> p2=poly(r)

p2 =

1 -5 10 -10 4

>> poly2sym8p2)??? poly2sym8p2) |Error: Unbalanced or unexpected parenthesis or bracket. >> poly2sym(p2) ans = x^4 - 5*x^3 + 10*x^2 - 10*x + 4 >> px=poly2sym(p2) px = x^4 - 5*x^3 + 10*x^2 - 10*x + 4 >> sym2poly(px)

ans =

1 -5 10 -10 4

>> pretty(px)

4 3 2 x - 5 x + 10 x - 10 x + 4>> pq=conv(p,q)??? Undefined function or variable 'q'. >> q=[1 0 0 2 3]

q =

1 0 0 2 3

>> pq=conv(p,q)

pq =

1 2 3 6 7 12 17 12

>> [g j]=deconv(p,q)

g =

0

j =

1 2 3 4

>> [g h]=deconv(q,p)

g =

1 -2

h =

0 0 1 4 11

>> pr=polyval(p,2)

pr =

26

>> ps=polyval(p,[3 5 8])

ps =

58 194 668

>> d=polyder(p)

d =

3 4 3

>> i=polyint(p)

i =

0.2500 0.6667 1.5000 4.0000 0

>> diff(px) ans = 4*x^3 - 15*x^2 + 20*x - 10 >> f=e^-x - x;??? Undefined function or variable 'e'. >> f=exp(-x)-x??? Undefined function or variable 'x'. >> f=exp(-'x')-'x';>> f=exp(-'x')-'x'

f =

-120

>> f=exp(-x)-x??? Undefined function or variable 'x'. >> >> f=exp(-x)-x??? Undefined function or variable 'x'. >> symsx??? Undefined function or variable 'symsx'. >> syms(x)??? Undefined function or variable 'x'. >> sym(x)??? Undefined function or variable 'x'. >> symx??? Undefined function or variable 'symx'. >> sym x ans = x >> f=exp(-x)-x??? Undefined function or variable 'x'. >> f=exp(-x)-x;diff(f)??? Undefined function or variable 'x'. >> sym x ans = x >> u=exp(-x)-x??? Undefined function or variable 'x'. >> syms x>> u=exp(-x)-x u = 1/exp(x) - x >> diff(u) ans = - 1/exp(x) - 1 >> int(u) ans = - 1/exp(x) - x^2/2 >> e=f eval(u,5)??? e=f eval(u,5) |Error: Unexpected MATLAB expression. >> e=feval(u,5)??? Error using ==> fevalArgument must contain a string or function_handle. >> f=inline(f)??? Error using ==> inline.inline at 47Input must be a string. >> F=inline(F)??? Undefined function or variable 'F'. >> F=inline(F)??? Undefined function or variable 'F'. >> F=inline(u)

F =

Inline function: F(x) = 1./exp(x) - x

>> e=F eval(u,5)??? e=F eval(u,5) |Error: Unexpected MATLAB expression. >> e=Feval(u,5)??? Undefined function or method 'Feval' for input arguments of type 'sym'. >> e=Feval(F,5)Warning: Could not find an exact (case-sensitive) match for 'Feval'.C:\Archivos de programa\MATLAB\R2008b\toolbox\matlab\funfun\@inline\feval.m is acase-insensitive match and will be used instead.You can improve the performance of your code by using exactname matches and we therefore recommend that you update yourusage accordingly. Alternatively, you can disable this warning usingwarning('off','MATLAB:dispatcher:InexactCaseMatch').This warning will become an error in future releases.

e =

-4.9933

>> sub(u,5)??? Undefined function or method 'sub' for input arguments of type 'sym'. >> sub(F,5)??? Undefined function or method 'sub' for input arguments of type 'inline'. >> E=sub(u,5)??? Undefined function or method 'sub' for input arguments of type 'sym'. >> syms x>> E=sub(u,5)??? Undefined function or method 'sub' for input arguments of type 'sym'. >> syms u>> E=sub(u,5)??? Undefined function or method 'sub' for input arguments of type 'sym'. >> syms x>> E=sub(u,5)??? Undefined function or method 'sub' for input arguments of type 'sym'. >> syms x>> E=sub(u,5)??? Undefined function or method 'sub' for input arguments of type 'sym'. >> E=sub(F,5)??? Undefined function or method 'sub' for input arguments of type 'inline'. >> E=subs(u,5)

E =

5

>> x=[110 140 160 168 172]

x =

110 140 160 168 172

>> y=[5 7 9 12 15]

y =

5 7 9 12 15

>> p3=polyfit(x,y,3)

p3 =

0.0002 -0.0808 10.9280 -483.4312

>> plot(x,y)>> plot(x,y)>> interp1(x,y,linear)

??? Error using ==> interp1 at 165The interpolation points XI should be real. >> interp1(x,y,'linear')

ans =

172 NaN NaN NaN NaN

>> interp1(x,y,'cubic')

ans =

172.0000 160.0000 94.6667 -173.3333 -741.3333

>> interp1(x,y,'cubic')

ans =

172.0000 160.0000 94.6667 -173.3333 -741.3333

>> interp1(x,y,'spline')

ans =

1.0e+003 *

0.1720 0.2100 0.3580 0.9700 2.3020

>> p3(10)??? Attempted to access p3(10); index out of bounds because numel(p3)=4. >> polival(p3)??? Undefined function or method 'polival' for input arguments of type 'double'. >> poliyval(p3)??? Undefined function or method 'poliyval' for input arguments of type 'double'. >> poliyval(pxx,10)??? Undefined function or variable 'pxx'. >> poliyval(px,10)??? Undefined function or method 'poliyval' for input arguments of type 'sym'. >> poliyval(p3,10)??? Undefined function or method 'poliyval' for input arguments of type 'double'. >> polyval(pxx,10)??? Undefined function or variable 'pxx'. >> polyval(p3,10)

ans =

-382.0312

>> ps=polyfit(y,x,3)

ps =

0.0916 -3.6637 49.7208 -58.7915

>> polyval(ps,10)

ans =

163.6549

>> figure(1)>> figure(1)=plot(x,y)

figure =

171.0034

>> interp1(x,y,10,'cubic')

ans =

15.0681

>> interp1(y,x,10,'cubic')

ans =

163.6255

>> interp1(y,x,10,'spline')

ans =

164.9568

>> x=[5 7 9 12 15]

x =

5 7 9 12 15

>> y=[110 140 160 168 172]

y =

110 140 160 168 172

>> xx=5:0.

xx =

Empty matrix: 1-by-0

>> xx=5:0.1:15;>> xx=5:0.1:15

xx =

Columns 1 through 9

5.0000 5.1000 5.2000 5.3000 5.4000 5.5000 5.6000 5.7000 5.8000

Columns 10 through 18

5.9000 6.0000 6.1000 6.2000 6.3000 6.4000 6.5000 6.6000 6.7000

Columns 19 through 27

6.8000 6.9000 7.0000 7.1000 7.2000 7.3000 7.4000 7.5000 7.6000

Columns 28 through 36

7.7000 7.8000 7.9000 8.0000 8.1000 8.2000 8.3000 8.4000 8.5000

Columns 37 through 45

8.6000 8.7000 8.8000 8.9000 9.0000 9.1000 9.2000 9.3000 9.4000

Columns 46 through 54

9.5000 9.6000 9.7000 9.8000 9.9000 10.0000 10.1000 10.2000 10.3000

Columns 55 through 63

10.4000 10.5000 10.6000 10.7000 10.8000 10.9000 11.0000 11.1000 11.2000

Columns 64 through 72

11.3000 11.4000 11.5000 11.6000 11.7000 11.8000 11.9000 12.0000 12.1000

Columns 73 through 81

12.2000 12.3000 12.4000 12.5000 12.6000 12.7000 12.8000 12.9000 13.0000

Columns 82 through 90

13.1000 13.2000 13.3000 13.4000 13.5000 13.6000 13.7000 13.8000 13.9000

Columns 91 through 99

14.0000 14.1000 14.2000 14.3000 14.4000 14.5000 14.6000 14.7000 14.8000

Columns 100 through 101

14.9000 15.0000

>> yy=polyval(pxx,[xx]);??? Undefined function or variable 'pxx'. >> yy=polyval(pxx,[xx])??? Undefined function or variable 'pxx'. >> yy=polyval(pxx,[xx])??? Undefined function or variable 'pxx'. >> syms pxx>> yy=polyval(pxx,[xx])??? Error using ==> polyvalInputs to polyval must be floats, namely single or double.

Error in ==> polyval at 63y = zeros(siz_x, superiorfloat(x,p)); >> yy=polyval(pxx,[xx]);??? Error using ==> polyvalInputs to polyval must be floats, namely single or double.

Error in ==> polyval at 63y = zeros(siz_x, superiorfloat(x,p)); >> yy=polyval(px,[xx]);??? Error using ==> polyvalInputs to polyval must be floats, namely single or double.

Error in ==> polyval at 63y = zeros(siz_x, superiorfloat(x,p)); >> yy= polyval(px,[xx]);??? Error using ==> polyvalInputs to polyval must be floats, namely single or double.

Error in ==> polyval at 63y = zeros(siz_x, superiorfloat(x,p)); >> yy= polyval(px,[xx])??? Error using ==> polyvalInputs to polyval must be floats, namely single or double.

Error in ==> polyval at 63y = zeros(siz_x, superiorfloat(x,p)); >> yy= polyval(pxx,[xx])??? Error using ==> polyvalInputs to polyval must be floats, namely single or double.

Error in ==> polyval at 63y = zeros(siz_x, superiorfloat(x,p)); >> yy= polyval(Pxx,[xx])??? Undefined function or variable 'Pxx'. >> yy= polyval(Px,[xx])??? Undefined function or variable 'Px'. >> yy= polyval(Px,[xx]);??? Undefined function or variable 'Px'. >> yy=polyval(Pxx,[xx]);??? Undefined function or variable 'Pxx'. >> >> y=polyval(Pxx,[xx]);??? Undefined function or variable 'Pxx'. >> yk=polyval(Pxx,[xx]);??? Undefined function or variable 'Pxx'. >> p=[12 15 16 8]

p =

12 15 16 8

>> polu(p)??? Undefined function or method 'polu' for input arguments of type 'double'. >> poly(p)

ans =

1 -51 956 -7776 23040

>> roots(p)

ans =

-0.2737 + 0.9348i -0.2737 - 0.9348i -0.7027

>> polyder(p)

ans =

36 30 16

>> polyval(p,[roots(p)])

ans =

1.0e-013 *

0.0178 - 0.1021i 0.0178 + 0.1021i 0.0266

>> polyval(poliderp,[roots(p)])??? Undefined function or variable 'poliderp'. >> polyval(polider(p),[roots(p)])??? Undefined function or method 'polider' for input arguments of type 'double'. >> polyval(polider(p),roots(p))??? Undefined function or method 'polider' for input arguments of type 'double'. >> polyval(polyder(p),roots(p))

ans =

-20.9725 + 9.6253i -20.9725 - 9.6253i 12.6950

>> x=[12 15 16 13]

x =

12 15 16 13

>> y=[8 9 7 6]

y =

8 9 7 6

>> y2=interp1(x,y,[linspace(5,15,100)],'cubic');>> p=[12 15 16]

p =

12 15 16

>> q=[2 3 6]

q =

2 3 6

>> roots(p-q)

ans =

-0.6000 + 0.8000i -0.6000 - 0.8000i

>> polyval(q,[roots(q)])

ans =

0 0

>> y2=interp1(x,y,[linspace(5,15,100)],'cubic')

y2 =

Columns 1 through 9

-239.3333 -227.9251 -216.8621 -206.1390 -195.7508 -185.6923 -175.9584 -166.5438 -157.4434

Columns 10 through 18

-148.6521 -140.1648 -131.9762 -124.0813 -116.4748 -109.1516 -102.1066 -95.3346 -88.8305

Columns 19 through 27

-82.5890 -76.6051 -70.8736 -65.3894 -60.1472 -55.1420 -50.3686 -45.8218 -41.4964

Columns 28 through 36

-37.3874 -33.4896 -29.7978 -26.3068 -23.0116 -19.9069 -16.9877 -14.2486 -11.6847

Columns 37 through 45

-9.2908 -7.0616 -4.9921 -3.0770 -1.3113 0.3102 1.7927 3.1413 4.3612

Columns 46 through 54

5.4576 6.4355 7.3001 8.0566 8.7102 9.2660 9.7291 10.1047 10.3980

Columns 55 through 63

10.6141 10.7581 10.8353 10.8507 10.8095 10.7169 10.5781 10.3981 10.1822

Columns 64 through 72

9.9354 9.6630 9.3700 9.0617 8.7432 8.4197 8.0962 7.7781 7.4703

Columns 73 through 81

7.1781 6.9066 6.6609 6.4463 6.2679 6.1308 6.0401 6.0011 6.0143

Columns 82 through 90

6.0699 6.1630 6.2891 6.4434 6.6215 6.8185 7.0299 7.2510 7.4773

Columns 91 through 99

7.7040 7.9265 8.1402 8.3405 8.5227 8.6822 8.8143 8.9144 8.9778

Column 100

9.0000

>> p=[12 15 16]

p =

12 15 16

>> polyint(p[3 7])??? polyint(p[3 7]) |Error: Unbalanced or unexpected parenthesis or bracket. >> polyint(p)

ans =

4.0000 7.5000 16.0000 0

>> poly2sym(p) ans = 12*x^2 + 15*x + 16 >> ps=[1 0 0 8 0]

ps =

1 0 0 8 0

>> pu=[0 0 0 1 0]

pu =

0 0 0 1 0

>> roots(ps-pu)

ans =

0 -1.9129 0.9565 + 1.6566i 0.9565 - 1.6566i

>> q=[15 12 16 17]

q =

15 12 16 17

>> potyint(polyint(q))??? Undefined function or method 'potyint' for input arguments of type 'double'. >> a=polyint(q)

a =

3.7500 4.0000 8.0000 17.0000 0

>> q=polyint(a)

q =

0.7500 1.0000 2.6667 8.5000 0 0

>> q=[15 12 16 17]

q =

15 12 16 17

>> a=polyder(q)

a =

45 24 16

>> w=polyint(a)

w =

15 12 16 0

>> w=polyder(a)

w =

90 24

>> q=[15 12 16 17]

q =

15 12 16 17

>> p=[12 15 16]

p =

12 15 16

>> t=poly[roots(p)' roots(q)']??? t=poly[roots(p)' roots(q)'] |Error: Unbalanced or unexpected parenthesis or bracket. >> t=poly[roots(q)' roots(p)']??? t=poly[roots(q)' roots(p)'] |Error: Unbalanced or unexpected parenthesis or bracket. >> t=poly[roots(q') roots(p')]??? t=poly[roots(q') roots(p')] |Error: Unbalanced or unexpected parenthesis or bracket. >> t=poly[roots(q)' roots(p)']??? t=poly[roots(q)' roots(p)'] |Error: Unbalanced or unexpected parenthesis or bracket. >> t=poly([roots(q)' roots(p)'])

t =

1.0000 2.0500 3.4000 3.5333 2.8389 1.5111

>>


Recommended