Diferencia entre revisiones de «Level sets of a scalar field»

De MateWiki
Saltar a: navegación, buscar
 
(No se muestran 13 ediciones intermedias del mismo usuario)
Línea 17: Línea 17:
 
contour(xx,yy,f)      % Draw the level sets
 
contour(xx,yy,f)      % Draw the level sets
 
hold on                % We draw the boundary below
 
hold on                % We draw the boundary below
plot(u,u-u,'k','linewidth',1);
+
plot(x,x-x,'k','linewidth',1);
plot(u,2+u-u,'k','linewidth',1);
+
plot(x,2+x-x,'k','linewidth',1);
plot(-0.5+v-v,v,'k','linewidth',1);
+
plot(-0.5+y-y,y,'k','linewidth',1);
plot(0.5+v-v,v,'k','linewidth',1);
+
plot(0.5+y-y,y,'k','linewidth',1);
 
axis([-2,2,-1,3])      % select region for drawing
 
axis([-2,2,-1,3])      % select region for drawing
 
view(2)                % See the pisture from the top
 
view(2)                % See the pisture from the top
 +
colorbar              % Include colorbar
 
}}
 
}}
  
Línea 39: Línea 40:
 
[[Categoría:Articles in English]]
 
[[Categoría:Articles in English]]
 
[[Categoría:TC14/15]]
 
[[Categoría:TC14/15]]
 +
[[Categoría:TC15/16]]
 +
[[Categoría:TC16/17]]
 +
[[Categoría:TC17/18]]
 +
[[Categoría:TC18/19]]
 +
[[Categoría:TC19/20]]
 +
[[Categoría:TC20/21]]
 +
[[Categoría:TC21/22]]
 +
[[Categoría:TC25/26]]
 +
[[Categoría:Informática]]

Revisión actual del 20:13 25 nov 2025

Level sets of a scalar function

We show how to visualize level sets of scalar fields on plane regions with Octave UPM. We focus on the example in Dibujar un sólido 2-D, i.e. the rectangle [math] [-1/2,1/2]\times [0,2][/math] and the scalar field [math] f(x,y)=-\log (0.1+\sqrt{x^2+y^2})[/math]. We follow the steps:

  1. We introduce a sampling of the two segments with a suitable step
  2. With meshgrid command we define two matrixes with the x and y coordenates of the mesh points
  3. Compute the scalar field in the grid points.
  4. We use the contour command to draw the field and adjunst the axis. We see the picture from the top.

1 MATLAB code

x=-0.5:0.1:0.5;       % sampling of the interval [-1/2,1/2]
y=0:0.1:2;            % sampling of the interval [0,2]
[xx,yy]=meshgrid(x,y); % matrixes of x and y coordinates
figure(1)
f=-log(0.1+sqrt(xx.^2+yy.^2)); % The scalar field
contour(xx,yy,f)       % Draw the level sets
hold on                % We draw the boundary below
plot(x,x-x,'k','linewidth',1);
plot(x,2+x-x,'k','linewidth',1);
plot(-0.5+y-y,y,'k','linewidth',1);
plot(0.5+y-y,y,'k','linewidth',1);
axis([-2,2,-1,3])      % select region for drawing
view(2)                % See the pisture from the top
colorbar               % Include colorbar


2 To go further

Mesh of a parametrized 2-D solid

Visualization of a scalar field in a solid

Visualization of vector fields in a solid

Dibujar un sólido 2-D