3d mesh and index operations
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I've a 3d grid:
[X,Y,Z] = meshgrid(0:250:1000,0:250:1000,0:250:1000);
and a surface (in this example a plane):
[xi,yi] = meshgrid(0:250:1000,0:250:1000);
zi = xi .* 0.5 + yi .* 0.1;
To assign at each node a selected propriety (th) I write for the nodes above the surface
for i = 1:5
for j = 1:5
for k = 1:zi(i,j)
th(i,j,k) = 1.5
end
end
end
end for the nodes below the surface? Any suggestions are grateful.
gianluca
2 commentaires
Mark Whirdy
le 9 Juil 2012
Hi Gianluca
I think some of your question maybe got cut off - what is the issue with your code?
Can you explain what this means?: "To assign at each node a selected propriety (th) I write for the nodes above the surface"
Best Rgds, mark
Réponse acceptée
Mark Whirdy
le 9 Juil 2012
Modifié(e) : Mark Whirdy
le 9 Juil 2012
To give this the best chance of being answered by someone in the community here, I think its a good idea to explain it without using any application-specific terminology (node, layer, conductivity, boundary, depth) and only talking about the variables, dimensions and indexes (i,j,k) and other matlab terms.
(Having a bit of guess at this ...) Assuming that your code snippet successfully assigns 1.5 to those elements of "th" that are "above the depth zi ", it seems that ALL of the remaining elements of "th" (having value 0) are then "at nodes below the depth zi" and you want to assign a "different value" to ALL of these (is this right??). Then you need only replace all zeros with your "different_value" (see snippet below)
If I've misinterpreted this, you'll need to help me out with a more generic application-independent explanation. Let me know
different_value = 2.5;
th(th==0) = different_value;
0 commentaires
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!