Generate a circle in FORTRAN having polar coordinates

In summary, the conversation discusses creating a grid in polar coordinates and plotting it in Tecplot. It is suggested to loop on the variables r and θ to create the grid and select the polar line option in Tecplot. It is also mentioned that in any language, the points with coordinates x = r cos(θ) and y = r sin(θ) will be spaced around a circle of radius r if θ goes from 0 to 2π. Finally, it is confirmed that the conversation is about Tecplot and the issue was resolved.
  • #1
sharmaN
4
1
Say "I have grid in polar coordinates (r, theta). How do I plot it in tecplot. Tecplot plots it in cartesian coordinates."
 
Last edited:
Technology news on Phys.org
  • #2
I don't understand. To make a X-Y grid, loop on X and loop on Y. To make a r-θ grid, loop on r and loop on θ.

Perhaps you want to make a rectangular grid within a circle?
 
  • #3
Is this a question about Fortran or about Tecplot?
 
  • #4
anorlunda said:
I don't understand. To make a X-Y grid, loop on X and loop on Y. To make a r-θ grid, loop on r and loop on θ.

Perhaps you want to make a rectangular grid within a circle?
DrClaude said:
Is this a question about Fortran or about Tecplot?
About Techplot.
 
  • #5
Ifound in tecplot to plot in polar coordinates, need to select polar line. Thanks
 
  • #6
FYI, in any language, if you let ##\theta## go from 0 to ##2\pi## then the points with cartesian coordinates ##x = r \cos(\theta), y = r \sin(\theta)## will be spaced around the circle of radius ##r##.
 
  • #7
RPinPA said:
FYI, in any language, if you let ##\theta## go from 0 to ##2\pi## then the points with cartesian coordinates ##x = r \cos(\theta), y = r \sin(\theta)## will be spaced around the circle of radius ##r##.
Yes thank you, I have the grid. Was facing problem in plotting it.
 

1. How do I generate a circle in FORTRAN using polar coordinates?

To generate a circle in FORTRAN using polar coordinates, you will need to use the DO loop and the SIN and COS functions. First, initialize the angle variable to 0 and the radius variable to the desired radius of the circle. Then, use the DO loop to increment the angle variable by a small amount (such as 0.01) until it reaches 2*PI (360 degrees). Within the loop, use the SIN and COS functions to calculate the x and y coordinates of each point on the circle. Finally, plot these points using the appropriate plotting function.

2. What is the difference between Cartesian and polar coordinates?

Cartesian coordinates use the x and y axes to represent a point in a two-dimensional space, while polar coordinates use the distance from the origin (radius) and the angle from the positive x-axis (theta) to represent a point. While Cartesian coordinates are more commonly used in everyday life, polar coordinates are useful for representing circular or radial patterns.

3. How do I convert from Cartesian to polar coordinates in FORTRAN?

To convert from Cartesian to polar coordinates in FORTRAN, you will need to use the ATAN2 function. This function takes two arguments (y and x) and returns the arctangent of y/x. This value will be the angle (theta) in polar coordinates. To calculate the radius, you can use the SQRT function to find the square root of (x^2 + y^2).

4. Can I use polar coordinates to draw other shapes besides a circle?

Yes, you can use polar coordinates to draw other shapes such as ovals, ellipses, and spirals. The key is to vary the radius and/or angle increment within the DO loop to create different shapes. For example, to draw an oval, you can use a different radius for the x and y coordinates, or to draw a spiral, you can use a larger angle increment as the loop progresses.

5. How can I modify my FORTRAN code to generate multiple circles with different radii?

To generate multiple circles with different radii using FORTRAN, you can use nested DO loops. The outer loop can iterate through a list of radii, while the inner loop follows the same steps as mentioned in the first question to plot a circle with the current radius. This will allow you to easily generate multiple circles with varying radii using the same code.

Similar threads

  • Programming and Computer Science
Replies
5
Views
2K
Replies
8
Views
216
  • General Math
Replies
7
Views
1K
  • Differential Geometry
Replies
4
Views
714
Replies
2
Views
1K
Replies
1
Views
334
  • Differential Geometry
Replies
9
Views
395
  • Advanced Physics Homework Help
Replies
4
Views
761
Replies
8
Views
977
Back
Top