3d mesh and index operations
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Mark Whirdy
2012 年 7 月 9 日
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
採用された回答
Mark Whirdy
2012 年 7 月 9 日
編集済み: Mark Whirdy
2012 年 7 月 9 日
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 件のコメント
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!