Diferencia entre revisiones de «Archivo:Area aproximada.png»
De MateWiki
(Aproximación del área bajo una curva) |
|||
| Línea 1: | Línea 1: | ||
| − | Aproximación del área bajo una curva | + | == Aproximación del área bajo una curva == |
| + | |||
| + | Para generar este archivo se ha usado la siguiente función de [[Octave UPM]] | ||
| + | {{ matlab | codigo = | ||
| + | function dibujaFunc(x,f,s) | ||
| + | clf; | ||
| + | hold on; | ||
| + | set(gca,'FontSize',14); | ||
| + | set(gca,'FontWeight','bold'); | ||
| + | set(gca,'LineWidth',4); | ||
| + | grid minor; | ||
| + | for xx = min(x):s:max(x)-s | ||
| + | fill([xx xx+s xx+s xx],[0 0 f(xx+s) f(xx+s)], 'y'); | ||
| + | x2 = linspace(xx, xx+s, 50); | ||
| + | y2 = f(x2); | ||
| + | fill([x2 xx xx],[y2 f(xx+s) f(xx)], 'r'); | ||
| + | end | ||
| + | plot(x,f(x), 'LineWidth',16); | ||
| + | text(11,25,'A_1','fontsize',24,'fontweight','bold'); | ||
| + | text(13,25,'A_2','fontsize',24,'fontweight','bold'); | ||
| + | text(15,25,'A_3','fontsize',24,'fontweight','bold'); | ||
| + | text(17,25,'A_4','fontsize',24,'fontweight','bold'); | ||
| + | text(19,25,'A_5','fontsize',24,'fontweight','bold'); | ||
| + | xlabel('Eje X'); | ||
| + | ylabel('Eje Y'); | ||
| + | hold off; | ||
| + | end}} | ||
| + | |||
| + | Luego, se llama a la función con | ||
| + | {{#tag:source|>> x = linspace(10,20,100); | ||
| + | >> dibujaFunc(x,@(x) (3+sin(x))/100.*x.^3+x+1,2);|lang="matlab"}} | ||
Revisión del 19:16 19 ago 2013
Aproximación del área bajo una curva
Para generar este archivo se ha usado la siguiente función de Octave UPM
function dibujaFunc(x,f,s)
clf;
hold on;
set(gca,'FontSize',14);
set(gca,'FontWeight','bold');
set(gca,'LineWidth',4);
grid minor;
for xx = min(x):s:max(x)-s
fill([xx xx+s xx+s xx],[0 0 f(xx+s) f(xx+s)], 'y');
x2 = linspace(xx, xx+s, 50);
y2 = f(x2);
fill([x2 xx xx],[y2 f(xx+s) f(xx)], 'r');
end
plot(x,f(x), 'LineWidth',16);
text(11,25,'A_1','fontsize',24,'fontweight','bold');
text(13,25,'A_2','fontsize',24,'fontweight','bold');
text(15,25,'A_3','fontsize',24,'fontweight','bold');
text(17,25,'A_4','fontsize',24,'fontweight','bold');
text(19,25,'A_5','fontsize',24,'fontweight','bold');
xlabel('Eje X');
ylabel('Eje Y');
hold off;
end
Luego, se llama a la función con
>> x = linspace(10,20,100);
>> dibujaFunc(x,@(x) (3+sin(x))/100.*x.^3+x+1,2);Historial del archivo
Haz clic sobre una fecha/hora para ver el archivo a esa fecha.
| Fecha y hora | Miniatura | Dimensiones | Usuario | Comentario | |
|---|---|---|---|---|---|
| actual | 15:36 20 ago 2013 | 1200 × 900 (81 KB) | Herraiz (Discusión | contribuciones) | Rayado homogéneo | |
| 19:12 19 ago 2013 | 1200 × 900 (48 KB) | Herraiz (Discusión | contribuciones) | Aproximación del área bajo una curva |
- No puedes sobrescribir este archivo.
Usos del archivo
La siguiente página enlaza a este archivo: