Webwork Inter
Webwork Inter
clear
function [a, A]=ild(x, y)
n=length(x)-1;
A=x'.^0;
for i=1:n
A=[A,x'.^i];
end
a=linsolve(A,-y');
endfunction
b=[1,3.5,8.5]
c=[5.91264980037637,5.71587636895528,5.4007433682184]
[a,A]=ild(b,c)
p=poly(a,'x','coeffs')
//PROBLEMA 2
hora=[18,20,22,25,30]
temperatura=[998,1005,1007,1012,1015]
T=interpln([hora;temperatura],28)
//PROBLEMA 3
function [a, A]=ild(x, y)
n=length(x)-1;
A=x'.^0;
for i=1:n
A=[A,x'.^i];
end
a=linsolve(A,-y');
endfunction
b=[2,4.8,6.7,9.2]
c=[56,56.5,57,54.5]
[a,A]=ild(b,c)
p=poly(a,'x','coeffs')
//PROBLEMA 6
function [a, A]=ild(x, y)
n=length(x)-1;
A=x'.^0;
for i=1:n
A=[A,x'.^i];
end
a=linsolve(A,-y');
endfunction
b=[2,4,6.5]
c=[2.2,.6,2.5]
[a,A]=ild(b,c)
p=poly(a,'x','coeffs')
//PROBLEMA 7 (INCONCLUSO)
hora=[4,4.5,5,5.5,6,6.5,7,7.5,8]
temperatura=[5.1,5.8,7.2,8.8,9.6,10.1,10.5,10.7,11.2]
T=interpln([hora;temperatura],6.2)
function y=f(x)
distancia=[4,4.5,5,5.5,6,6.5,7,7.5,8]
fuerza=[5.1,5.8,7.2,8.8,9.6,10.1,10.5,10.7,11.2]
y=interpln([distancia;fuerza],x)*cos(.1*sqrt(x))
endfunction
q=integrate("f","x",4,8)
//PROBLEMA 8
clear
function [a, A]=ild(x, y)
n=length(x)-1;
A=x'.^0;
for i=1:n
A=[A,x'.^i];
end
a=linsolve(A,-y');
endfunction
b=[6.5,9.1,12.2,15.2,16.4,20.3,25.4]
c=[111,146,187,230,265,306,355]
[a,A]=ild(b,c)
p=poly(a,'x','coeffs')
//PROBLEMA 9
clear
function [a, A]=ild(x, y)
n=length(x)-1;
A=x'.^0;
for i=1:n
A=[A,x'.^i];
end
a=linsolve(A,-y');
endfunction
b=[2.4,5.9,8.9,10.9]
c=[7.6,7.4,8.2,8.6]
[a,A]=ild(b,c)
p=poly(a,'x','coeffs')
plot(b,c,"or");
plot(2:0.1:11,horner(p,2:0.1:11))
z=4.36
9.3788364-1.1246357*z+0.1776031*z^2-0.0074294*z^3
//PROBLEMA 10
clear
function [a, A]=ild(x, y)
n=length(x)-1;
A=x'.^0;
for i=1:n
A=[A,x'.^i];
end
a=linsolve(A,-y');
endfunction
b=[.2,3.7,5.7,8.2]
c=[1.2,.8,2.4,0.300000000000001]
[a,A]=ild(b,c)
p=poly(a,'x','coeffs')
plot(b,c,"or");
plot(0:0.1:8.5,horner(p,0:0.1:8.5))
f(x)=1.6256702-2.2863072*z+0.8030476*z^2-0.0663348*z^3
function y=f(x)
y=1.6256702-2.2863072*x+0.8030476*x^2-0.0663348*x^3
endfunction
q=integrate("f","x",.2,7.5121)
//PROBLEMA 11
clear
function [a, A]=ild(x, y)
n=length(x)-1;
A=x'.^0;
for i=1:n
A=[A,x'.^i];
end
a=linsolve(A,-y');
endfunction
b=[.9,4.4,7.4,9.4]
c=[4.7,7.2,9.9,7.4]
[a,A]=ild(b,c)
p=poly(a,'x','coeffs')
z=8.752
5.7512242-1.7666857*z+0.7137311*z^2-0.0539496*z^3
R1/.=9.295787
R2/.=
plot(b,c,"or");
plot(0:0.1:10,horner(p,0:0.1:10))
//PROBLEMA 12
clear
function [a, A]=ild(x, y)
n=length(x)-1;
A=x'.^0;
for i=1:n
A=[A,x'.^i];
end
a=linsolve(A,-y');
endfunction
b=[160,176,194,225,246,265,280]
c=[134,103,95,87,78,56,52]
[a,A]=ild(b,c)
p=poly(a,'x','coeffs',"natural")
plot(b,c,"or");
plot(160:0.1:280,horner(p,160:0.1:280))
clear
function y=f(x)
b=[160,176,194,225,246,265,280]
c=[134,103,95,87,78,56,52]
d=splin(b,c,"natural")
y=interp(x,b,c,d)
endfunction
Q=derivative(f,168)
q=integrate("f","x",160,280)
//PROBLEMA 13
clear
function y=f(x)
b=[160,181,195,211,234,258,283]
c=[127,113,98,81,80,58,50]
d=splin(b,c,"natural")
y=interp(x,b,c,d)
endfunction
f(248.4)
Q=derivative(f,222.5)
q=integrate("f","x",160,283)
//PROBLEMA 14
clear
function y=f(x)
b=[60,83,99,123,148,170,173]
c=[1.6,2,3.5,3.8,4.7,5.4,5.6]
d=splin(b,c,"natural")
y=interp(x,b,c,d)
endfunction
f(248.4)
Q=derivative(f,91)
q=integrate("f","x",60,173)
//PROBLEMA 15
clear
function y=f(x)
b=[151,179,191,215,235,265,276]
c=[134,150,183,225,233,252,261]
d=splin(b,c,"natural")
y=interp(x,b,c,d)
endfunction
Q=derivative(f,165)
q=integrate("f","x",151,276)
//PROBLEMA 16
clear
x=[-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0]
y=[7.3,8.1,8.9,9.7,11.5,17.2,17.8,17.9,18.3,18.4,18.6]
T=interpln([x;y],-5.5)
//PROBLEMA 17
//PROBLEMA 18
function y=f(x)
if x=1 x=2 then
y=5*x+1
end
endfunction
//PROBLEMA 19
//PROBLEMA 20
clear
x=[22,42,52,82,100]
y=[4181,4179,4186,4199,4217]
T=interpln([x;y],54)
//4186.8667
intg(47,61,(interpln([x;y])))
function y=f(x)
x1=[22,42,52,82,100]
y1=[4181,4179,4186,4199,4217]
y=interpln([x1;y1])
endfunction
R=(intg(47,61,f))/(61-47)
q=integrate("f","X",17,61)
//PROBLEMA 21
//PROBLEMA 22
//PROBLEMA 23
//PROBLEMA 24
clear
function y=f(x)
b=[-2.5,-1.1,.9,2.3,3.5,4.9,6.7]
c=[8,3.4,-.6,-4,-5.8,-8.4,-6.6]
d=splin(b,c,"natural")
y=interp(x,b,c,d)
endfunction
f(2.9)