How can I plot just a slice of circle that shows the degree of temperature
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
yogan sganzerla
el 30 de Sept. de 2017
Comentada: Star Strider
el 30 de Sept. de 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:
![](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 comentarios
Respuesta aceptada
Star Strider
el 30 de Sept. de 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 comentarios
Star Strider
el 30 de Sept. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!