How can I plot just a slice of circle that shows the degree of temperature
5 ビュー (過去 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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167694/image.png)
There is nothing wrong with the image but I would like something look like it:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167695/image.png)
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!