Uploaded by nachov7

Comandos Ayudantia 11

advertisement
Pregunta 1
f=@(x) exp(x)
a=0;
b=1;
N=21;
trozos(f,a,b,N)
A=trozos(f,0,1,N)
grafico_trozos(A,a,b,N)
hold on
x = a:(b-a)/1000:b;
plot(x,f(x),'b','LineWidth',4) xlabel('x')
x = 0:10;
y = f(x);
xq = 0:.25:10;
yq = spline(x,y,xq);
figure
plot(x,y,'o',xq,yq)
Pregunta 3?(Elipse)
x=[-1.024940;-0.949898;-0.866114;-0.773392;-0.671372;-0.559524;-0.437067;-0.302909;-0.155493;-0.007464];
y=[-0.389269;-0.322894;-0.265256;-0.216557;-0.177152;-0.147582;-0.128618;-0.121353;-0.127348;-0.148885];
w=[1;1;1;1;1;1;1;1;1;1];
[c0,c1,c2,c3,c4]=test(x,y,w)
s = min(x):0.1:max(x);
plot(x,y,'x','MarkerSize',10)
hold all
plot(s,polyval([c4,c3,c2,c1,c0],s),'LineWidth',4)
Download