필터 지우기
필터 지우기

How can I plot 2D temperature.

조회 수: 7 (최근 30일)
yogan sganzerla
yogan sganzerla 2017년 8월 4일
댓글: Star Strider 2017년 8월 5일
Hey, I have a matrix of the temperature from the geometry that is an circle.
I would like to know how can I plot it?
I am adding one image that looks like the result that I expect.

채택된 답변

Star Strider
Star Strider 2017년 8월 4일
Without your data or calculations, providing specific code is not possible.
You may have to calculate your data in polar coordinates, then transform them to Cartesian coordinates to plot them with the contourf function.
See if something like this does what you want:
a = linspace(0, 2*pi, 500);
r = sin(a).^2;
[A,R] = meshgrid(a,r);
Z = R .* sqrt(A);
[X,Y,Z] = pol2cart(A,R,Z);
figure(1)
contourf(X, Y, Z)
grid on
axis equal
  댓글 수: 2
yogan sganzerla
yogan sganzerla 2017년 8월 4일
Brow, thanks for the answer! Unfortunately, I don't have the data calculation.... What I have is the linear distribution, that I am adding here.
On the first Column is the circle radius and the second column is the temperature. It doesn't matter what degree, this distribution is the same for all 2 pi.
what should I change the code that you send before to adapt in my problem. Cheers!
Star Strider
Star Strider 2017년 8월 5일
If the angle goes from 0 to 2*pi in 52 steps, you can define the angle as:
a = linspace(0, 2*pi, 52);
After that, the radius and temperature are defined. You may not be able to use the contour or contourf functions with scalar data, because those functions require that the ‘z’ value be a matrix, and yours are a vector.
I am not certain what to suggest.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by