Professional Documents
Culture Documents
x=linspace(-2*pi,2*pi);
y=sin(X)+cos(x/2);
{#Unrecognized function or variable 'X'.
}#
y=sin(x)+cos(x/2);plot(x,y,'m-')
y=sin(x)+cos(x/2);
plot(x,y,'m-')
plot(x,y,'m-')
grid on
x1=132165;
x2=151326;
x3=179323;
x4=203302;
x5=226542;
x6=249633;
difdiv
{#Unrecognized function or variable 'difdiv'.
}#
difdiv(1)
{#Unrecognized function or variable 'difdiv'.
}#
difdiv (1)
{#Unrecognized function or variable 'difdiv'.
}#
difdiv
¿Cuántos valores vas a interpolar? 6
n =
X =
Y =
0.765197700000000 -0.483705666666666
0.620086000000000 -0.548946666666667
0.455402000000000 -0.578611333333334
0.281818600000000 -0.571520866666666
0.110362340000000 0
Columns 3 through 4
-0.108735000000001 0.065882098765432
-0.049441111111112 0.068065061728397
0.011817444444446 0
0 0
0 0
Column 5
0.001819135802471
0
0
0
0
El polinomio de newton es
/ 8 \ / 13 \
2373652763603099 (x - 1) | x - - | | x - -- |
\ 5 / \ 10 /
---------------------------------------------
36028797018963968
/ 13 \
7835182487714139 (x - 1) | x - -- |
\ 10 /
- -----------------------------------
72057594037927936
8713666640627985 x /
- ------------------ + | 8389283145875465 (x - 1)
18014398509481984 \
/ 8 \ / 13 \ /
| x - - | | x - -- | | x
\ 5 / \ 10 / \
19 \ \ 22498242946967027
- -- | |/4611686018427387904 + -----------------
10 / / 18014398509481984
4 3
8389283145875465 x 255169711495118975 x
------------------- + ---------------------
4611686018427387904 4611686018427387904
2
31648718412539498109 x 33887231375222191033 x
- ----------------------- + ----------------------
92233720368547758080 461168601842738790400
56360701833206916339
+ --------------------
57646075230342348800
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('difdiv', 'C:\
Users\nikta\OneDrive\Documents\MATLAB\difdiv.m', 45)" style="font-
weight:bold">difdiv</a> (<a href="matlab: opentoline('C:\Users\nikta\OneDrive\
Documents\MATLAB\difdiv.m',45,0)">line 45</a>)
ezplot(polnew,[X(1) X(n)]);
}#
difdiv
¿Cuántos valores vas a interpolar? 6
n =
X =
Columns 1 through 2
1.000000000000000 1.300000000000000
Columns 3 through 4
1.600000000000000 1.900000000000000
Column 5
2.200000000000000
Y =
Columns 1 through 2
0.765197700000000 0.620086000000000
Columns 3 through 4
0.455402000000000 0.281818600000000
Column 5
0.110362340000000
0.765197700000000 -0.483705666666666
0.620086000000000 -0.548946666666667
0.455402000000000 -0.578611333333334
0.281818600000000 -0.571520866666666
0.110362340000000 0
Columns 3 through 4
-0.108735000000001 0.065882098765432
-0.049441111111112 0.068065061728397
0.011817444444446 0
0 0
0 0
Column 5
0.001819135802471
0
0
0
0
El polinomio de newton es
/ 8 \ / 13 \
2373652763603099 (x - 1) | x - - | | x - -- |
\ 5 / \ 10 /
---------------------------------------------
36028797018963968
/ 13 \
7835182487714139 (x - 1) | x - -- |
\ 10 /
- -----------------------------------
72057594037927936
8713666640627985 x /
- ------------------ + | 8389283145875465 (x - 1)
18014398509481984 \
/ 8 \ / 13 \ /
| x - - | | x - -- | | x
\ 5 / \ 10 / \
19 \ \ 22498242946967027
- -- | |/4611686018427387904 + -----------------
10 / / 18014398509481984
4 3
8389283145875465 x 255169711495118975 x
------------------- + ---------------------
4611686018427387904 4611686018427387904
2
31648718412539498109 x 33887231375222191033 x
- ----------------------- + ----------------------
92233720368547758080 461168601842738790400
56360701833206916339
+ --------------------
57646075230342348800
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('difdiv', 'C:\
Users\nikta\OneDrive\Documents\MATLAB\difdiv.m', 41)" style="font-
weight:bold">difdiv</a> (<a href="matlab: opentoline('C:\Users\nikta\OneDrive\
Documents\MATLAB\difdiv.m',41,0)">line 41</a>)
x=input('ingrese el valor de x a interpolar,x= ');
}#
ingrese el valor de x a interpolar,x= c
{#Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('input')"
style="font-weight:bold">input</a>
Unrecognized function or variable 'c'.
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('difdiv', 'C:\
Users\nikta\OneDrive\Documents\MATLAB\difdiv.m', 41)" style="font-
weight:bold">difdiv</a> (<a href="matlab: opentoline('C:\Users\nikta\OneDrive\
Documents\MATLAB\difdiv.m',41,0)">line 41</a>)
x=input('ingrese el valor de x a interpolar,x= ');
}#
ingrese el valor de x a interpolar,x=
el valor interpolado es
{#Index exceeds the number of array elements. Index must
not exceed 5.
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('difdiv', 'C:\
Users\nikta\OneDrive\Documents\MATLAB\difdiv.m', 45)" style="font-
weight:bold">difdiv</a> (<a href="matlab: opentoline('C:\Users\nikta\OneDrive\
Documents\MATLAB\difdiv.m',45,0)">line 45</a>)
ezplot(polnew,[X(1) X(n)]);
}#
clc
clear
difdiv
¿Cuántos valores vas a interpolar? 6
n =
X =
8 9 10 11 12 13 14
Y =
41 35 21 9 11 17 32
41.000000000000000 -6.000000000000000
35.000000000000000 -14.000000000000000
21.000000000000000 -12.000000000000000
9.000000000000000 2.000000000000000
11.000000000000000 6.000000000000000
17.000000000000000 15.000000000000000
32.000000000000000 0
Columns 3 through 4
-4.000000000000000 1.666666666666667
1.000000000000000 2.000000000000000
7.000000000000000 -1.666666666666667
2.000000000000000 0.833333333333333
4.500000000000000 0
0 0
0 0
Columns 5 through 6
0.083333333333333 -0.200000000000000
-0.916666666666667 0.308333333333333
0.625000000000000 0
0 0
0 0
0 0
0 0
Column 7
0.084722222222222
0
0
0
0
0
0
El polinomio de newton es
5 (x - 8) (x - 9) (x - 10)
-------------------------- - 4 (x - 8) (x - 9)
3
(x - 8) (x - 9) (x - 10) (x - 11)
- 6 x + ---------------------------------
12
+ 89
6 5 4 3 2
61 x 443 x 21521 x 102283 x 6092627 x
----- - ------ + -------- - --------- + ----------
720 80 144 48 360
1064866 x
- --------- + 122945
15
clc
clear
x=linspace(-2*pi,2*pi);
y=sin(x)+cos(x/2);
plot(x,y)
grid on
hold on
%voy a extreaer 6 puntos
%7
n=6;
x=linspace(-2*pi,2*pi,n+1);
x
x =
Columns 1 through 2
-6.283185307179586 -4.188790204786391
Columns 3 through 4
-2.094395102393195 0
Columns 5 through 6
2.094395102393195 4.188790204786391
Column 7
6.283185307179586
f=@sin(x)+cos(x/2)
f=@sin(x)+cos(x/2)
↑
{#Invalid expression. When calling a function or
indexing a variable, use parentheses. Otherwise,
check for mismatched delimiters.
}#
f=@(x)sin(x)+cos(x/2)
f =
@(x)sin(x)+cos(x/2)
y=feval(f,x)
y =
Columns 1 through 2
-1.000000000000000 0.366025403784439
Columns 3 through 4
-0.366025403784439 1.000000000000000
Columns 5 through 6
1.366025403784439 -1.366025403784438
Column 7
-1.000000000000000
plot(x,y,'m-')
plot(x,y,'m*')
plot(x,y,'*')
hold on
spline_programa
Introduce el extremo inferior del intervalo l
{#Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('input')"
style="font-weight:bold">input</a>
Unrecognized function or variable 'l'.
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('spline_progra
ma', 'C:\Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m', 6)" style="font-
weight:bold">spline_programa</a> (<a href="matlab: opentoline('C:\Users\nikta\
OneDrive\Documents\MATLAB\spline_programa.m',6,0)">line 6</a>)
a=input('Introduce el extremo inferior del intervalo ')
}#
Introduce el extremo inferior del intervalo l
{#Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('input')"
style="font-weight:bold">input</a>
Unrecognized function or variable 'l'.
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('spline_progra
ma', 'C:\Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m', 6)" style="font-
weight:bold">spline_programa</a> (<a href="matlab: opentoline('C:\Users\nikta\
OneDrive\Documents\MATLAB\spline_programa.m',6,0)">line 6</a>)
a=input('Introduce el extremo inferior del intervalo ')
}#
Introduce el extremo inferior del intervalo l
{#Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('input')"
style="font-weight:bold">input</a>
Unrecognized function or variable 'l'.
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('spline_progra
ma', 'C:\Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m', 6)" style="font-
weight:bold">spline_programa</a> (<a href="matlab: opentoline('C:\Users\nikta\
OneDrive\Documents\MATLAB\spline_programa.m',6,0)">line 6</a>)
a=input('Introduce el extremo inferior del intervalo ')
}#
Introduce el extremo inferior del intervalo
a =
[]
b =
[]
Introduce la función
f =
[]
r1 =
[ empty sym ]
rn1 =
[ empty sym ]
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('spline_progra
ma', 'C:\Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m', 15)"
style="font-weight:bold">spline_programa</a> (<a href="matlab: opentoline('C:\
Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m',15,0)">line 15</a>)
x=linspace(a,b);
}#
diff(diff(sin(x)+cos(x/2)
diff(diff(sin(x)+cos(x/2)
↑
{#Invalid expression. When calling a function or
indexing a variable, use parentheses. Otherwise,
check for mismatched delimiters.
}#
diff(diff(sin(x)+cos(x/2)))
ans =
- cos(x/2)/4 - sin(x)
x=-2*pi
x =
-6.283185307179586
diff(diff(sin(x)+cos(x/2)))
ans =
[]
f=@(x)sin(x)+cos(x/2)
f =
@(x)sin(x)+cos(x/2)
f =
@(x)-cos(x/2)/4-sin(x)
r1=feval(f,-2*pi)
r1 =
0.250000000000000
rn=feval(f,2*pi)
rn =
0.250000000000000
x=linspace(-2*pi,2*pi,n+1);
f=@(x)sin(x)+cos(x/2);
y=feval(f,x);
%programa
spline_programa
Introduce el extremo inferior del intervalo 0.25
a =
0.250000000000000
b =
0.250000000000000
f =
cos(x/2) + sin(x)
r1 =
- cos(1/8)/4 - sin(1/4)
rn1 =
- cos(1/8)/4 - sin(1/4)
m =
n =
[]
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('spline_progra
ma', 'C:\Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m', 21)"
style="font-weight:bold">spline_programa</a> (<a href="matlab: opentoline('C:\
Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m',21,0)">line 21</a>)
x=linspace(a,b,n+1);
}#
spline_programa
Introduce el extremo inferior del intervalo -2*pi
a =
-6.283185307179586
b =
6.283185307179586
f =
cos(x/2) + sin(x)
r1 =
1/4
rn1 =
1/4
m =
n =
[]
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('spline_progra
ma', 'C:\Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m', 21)"
style="font-weight:bold">spline_programa</a> (<a href="matlab: opentoline('C:\
Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m',21,0)">line 21</a>)
x=linspace(a,b,n+1);
}#
spline_programa
Introduce el extremo inferior del intervalo 2*pi
a =
6.283185307179586
b =
-6.283185307179586
f =
cos(x/2) + sin(x)
r1 =
1/4
rn1 =
1/4
m =
n =
y =
[-1, - 3^(1/2)/2 - 1/2, 3^(1/2)/2 + 1/2, 1, 1/2 - 3^(1/2)/2, 3^(1/2)/2 - 1/2, -1]
h =
Columns 1 through 2
-2.094395102393196 -2.094395102393195
Columns 3 through 4
-2.094395102393195 -2.094395102393195
Columns 5 through 6
-2.094395102393195 -2.094395102393196
dp =
Columns 1 through 2
-1.396263401595464 -1.396263401595464
Columns 3 through 4
-1.396263401595464 -1.396263401595464
Column 5
-1.396263401595464
M =
Columns 1 through 2
-1.396263401595464 -0.349065850398866
-0.349065850398866 -1.396263401595464
0 -0.349065850398866
0 0
0 0
Columns 3 through 4
0 0
-0.349065850398866 0
-1.396263401595464 -0.349065850398866
-0.349065850398866 -1.396263401595464
0 -0.349065850398866
Column 5
0
0
0
-0.349065850398866
-1.396263401595464
e =
Columns 1 through 2
0.174764256928501 -1.304458172408374
Columns 3 through 4
0.174764256928501 0.652229086204187
Columns 5 through 6
-0.349528513857002 0.652229086204187
g =
Columns 1 through 2
-1.479222429336875 1.479222429336875
Columns 3 through 4
0.477464829275686 -1.001757600061189
Column 5
1.001757600061189
g =
Columns 1 through 2
-1.391955966737159 1.479222429336875
Columns 3 through 4
0.477464829275686 -1.001757600061189
Column 5
1.001757600061189
g =
Columns 1 through 2
-1.391955966737159 1.479222429336875
Columns 3 through 4
0.477464829275686 -1.001757600061189
Column 5
1.089024062660906
r =
1.327709318353173
-1.323177165308113
-0.272660765225300
1.045984247037753
-1.041452093992693
r =
1/4
5979471191391685/4503599627370496
-5959060188626767/4503599627370496
-4911819682668863/18014398509481984
4710694265194635/4503599627370496
-1172570815607429/1125899906842624
1/4
r =
0.250000000000000
1.327709318353173
-1.323177165308113
-0.272660765225300
1.045984247037753
-1.041452093992693
0.250000000000000
s =
Columns 1 through 2
-0.085761382616052 0.125000000000000
0.210950843725093 0.663854659176586
-0.083597438936141 -0.661588582654057
-0.104934435942569 -0.136330382612650
0.166112906032328 0.522992123518877
-0.102770492262658 -0.520726046996347
Columns 3 through 4
0.812755164421383 -1.000000000000000
-0.839418170258114 -1.366025403784439
-0.844164229828548 1.366025403784439
0.826993343132688 1.000000000000000
0.017170886695860 -0.366025403784439
0.012424827125425 0.366025403784439
a =
[]
b =
-6.283185307179586
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('spline_progra
ma', 'C:\Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m', 90)"
style="font-weight:bold">spline_programa</a> (<a href="matlab: opentoline('C:\
Users\nikta\OneDrive\Documents\MATLAB\spline_programa.m',90,0)">line 90</a>)
xg=linspace(a,b); %abcisas para el gráfico
}#
2*pi
ans =
6.283185307179586
diary off