- #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:
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?
About Techplot.DrClaude said:Is this a question about Fortran or about Tecplot?
Yes thank you, I have the grid. Was facing problem in plotting it.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##.
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.
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.
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).
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.
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.