필터 지우기
필터 지우기

Finite Temperature Variation - Heat Transfer

조회 수: 1 (최근 30일)
Kaelyn
Kaelyn 2013년 10월 12일
댓글: Youssef Khmou 2013년 10월 13일
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.
  댓글 수: 3
Kaelyn
Kaelyn 2013년 10월 13일
Yes, the triangle is at the top right corner of the square(nxn). I am having trouble identifying the cut off if the triangle on each row. The area is 1meter by 1meter and the missing area cut off is 1/2*.4^2. Giving a 45 degree angle.
Image Analyst
Image Analyst 2013년 10월 13일
편집: Image Analyst 2013년 10월 13일
If the triangle is formed by two sides and one side is "i" elements long, and the other side is "n-0.6*i" elements long, how is that a 45 degree angle for the hypoteneuse? To get 45 degrees, both sides would have to be the same length.

댓글을 달려면 로그인하십시오.

답변 (3개)

Image Analyst
Image Analyst 2013년 10월 13일
편집: Image Analyst 2013년 10월 13일
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.
  댓글 수: 2
Image Analyst
Image Analyst 2013년 10월 13일
Kaelyn's comment moved here, since it's not an answer to her original question, but a comment on mine.
Yes but n and i will change according to the size of the mesh. The cut off of the triangle will be identified and used to calculate other temperatures. So I have been trying to use the mod function.
Image Analyst
Image Analyst 2013년 10월 13일
편집: Image Analyst 2013년 10월 13일
n and i are variables in my code. You can change them. You can do everything with a for loop, instead of poly2mask(), if you want.

댓글을 달려면 로그인하십시오.


Youssef  Khmou
Youssef Khmou 2013년 10월 13일
편집: Youssef Khmou 2013년 10월 13일
Kaelyn,
OK the problem now is clear , here is fast way
N=500; % more resolution better 2D heat conduction resolution .
H=ones(N);
M=flipud(triu(H)); % TOP RIGHT TRIANGLE
surface(M);
shading interp
  댓글 수: 6
Youssef  Khmou
Youssef Khmou 2013년 10월 13일
편집: Youssef Khmou 2013년 10월 13일
N=100;
M=rot90(triu(ones(N),-60));
surface(M), shading interp
Youssef  Khmou
Youssef Khmou 2013년 10월 13일
is the problem solved by this last instruction?

댓글을 달려면 로그인하십시오.


Youssef  Khmou
Youssef Khmou 2013년 10월 13일
N=1000; % 1 meter sampled with 1000 Hz
p=0.6*N; % your 0.6 starting point .
M=zeros(N); % initial matrix
A=(N-p)/N; % the Coefficient for constructing the triangle
for n=1:N
M(n,1:A*n)=1;
end

카테고리

Help CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by