Gradient function not working
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Chris Brown
el 6 de En. de 2017
Comentada: Chris Brown
el 6 de En. de 2017
I have a 3D grid of data values (F). I modify a series of points (in a 1D strip). When I take the gradient of the function F , the gradient only takes the central difference in one direction. I am unsure why it does not take the difference in 3D?
Here is a simplified version of my code. Any help would be greatly appreciated.
Thanks
%%gradienttest
%test whether gradient works elsewhere
%variables
K = 2.87; %Thermal conductivity (W/ m K)
%general
sT = 10; %surface temperature ('C)
Tg = 2; %Temperature gradient ('C / 100 m)
Ini = 1; %initial conditons
nt = 100; %number of time steps
x = 0:100;
y = 0:100;
z = 0:60;
%%Mesh / grid
[X,Y,Z] = meshgrid(x,y,z);
%%Tnitial temperature model
F = sT + ( (Tg.*K.*Z)./K);Z=Y;
x = 101;
y = 101;
z = 61;
for a=1:Ini %Change in temperature of elements
i=x-45;
j=y-45;
%k=z-25;
k=34:z-22;
F(j,i,k)=30;
end
Tg=gradient(F,100,100,100);
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Oil, Gas & Petrochemical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!