I am writing a code that displays temperature variation. There is a triangle section cut off of a square(nxn) that is exposed to convection heat transfer. The part that is cut off is a 90 degree triangle between i and n-.6*i. I need help defining this section for every row because the slope is not in one row. The cut out part is after a certain meter distance.
No products are associated with this question.
Do you mean like this:
clc; n = 100 % Create sample random data. myArray = randi(9, [n, n], 'uint8') + 100; subplot(2, 2, 1); imshow(myArray); title('Original Image', 'FontSize', 20);
% Chop off i by n-6*i triangle i = 4 xvertices = [0, n-6*i, 0]; yvertices = [0,0, i]; mask = poly2mask(xvertices, yvertices, n, n); subplot(2,2,2); imshow(mask); title('Mask Image', 'FontSize', 20);
out = myArray .* uint8(~mask); subplot(2,2,3); imshow(out); title('Output Image', 'FontSize', 20);
% Enlarge figure to full screen. set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
Note: requires Image Processing Toolbox because of poly2mask.
OK the problem now is clear , here is fast way
N=500; % more resolution better 2D heat conduction resolution .
M=flipud(triu(H)); % TOP RIGHT TRIANGLE surface(M); shading interp