How can I plot just a slice of circle that shows the degree of temperature
2 views (last 30 days)
Show older comments
yogan sganzerla
on 30 Sep 2017
Commented: Star Strider
on 30 Sep 2017
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 Comments
Accepted Answer
Star Strider
on 30 Sep 2017
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 Comments
Star Strider
on 30 Sep 2017
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.
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!