How can I plot just a slice of circle that shows the degree of temperature
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I am using MatLab to study heat transfer and now I am developing a method for cylindrical coordinates. This is my code:
clear
clc
theta = linspace(-pi/8,pi/8,7);
r = linspace(0,1,10);
[AA,RR] = meshgrid(theta,r);
polar(AA,RR,'or');
How you can see, it's easy to understand what does it means. I made a grid to use FEM to solve.
When I run this cole the graphic shows:

There is nothing wrong with the image but I would like something look like it:

Probably it will be necessary to use other structure to plot the graphic, and not polar. Do you know what option do I have?
Cheers
댓글 수: 0
채택된 답변
Star Strider
2017년 9월 30일
I would use the pol2cart funciton:
theta = linspace(-pi/8,pi/8,7);
r = linspace(0,1,10);
[AA,RR] = meshgrid(theta,r);
[X,Y] = pol2cart(AA,RR);
figure(1)
plot(X,Y, 'or')
axis([-1.1 1.1 -1.1 1.1])
axis equal
Experiment with the axis function calls to get the plot appearance you want.
댓글 수: 2
Star Strider
2017년 9월 30일
I have no idea how you calculate ‘Z’, so I created an expression for it to illustrate the correct approach:
theta = linspace(-pi/8,pi/8,7);
r = linspace(0,1,10);
[AA,RR] = meshgrid(theta,r);
[X,Y] = pol2cart(AA,RR);
Z = 1./(RR); % Create ‘Z’
figure(2)
surf(X, Y, Z)
colormap(jet(length(r)));
view([0 90])
axis equal
This actually gives something similar to the figure you illustrate.
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!