Matlab - plot pressure distribution around a circle

In summary, the conversation discusses the process of plotting the pressure distribution around a cylinder in a uniform flow field using the polar function. The issue of the graph starting at the origin is addressed and a scaling factor is suggested to solve the problem. The conversation also includes the code for the calculation of the pressure coefficient and the final solution of using the sqrt function to incorporate the radius of the cylinder into the plot.
  • #1
super sky
6
0
I'm trying to plot the pressure distribution around a cylinder in a uniform flow field, so that the graphic is a circle with the pressure curve around it, like in the image below.
http://img843.imageshack.us/img843/4649/63792687.th.jpg

Uploaded with ImageShack.us

I have the equation for the ideal pressure coefficient Cp (which is what I'm wanting to display), and t is the theta values. (See code below)

Then I use the polar function to plot it... polar(t,Cp)... but that starts at the origin, which isn't what I want. I thought it might help if I added the radius of my proposed circle to Cp, but it doesn't. So maybe I need a scaling factor on Cp or something..?

Could someone help me out?
Thanks.

Code:
%%% Flow Around a Cylinder %%%

% Initialise variables
clear all
clc

U = 12;     % Freestream velocity m/s
M = 2;      % Doublet strength
radius = sqrt(M/2/pi/U);    % Cylinder radius
t = linspace(0,2*pi,50);    % Range of theta values
circle = ones(1,50);        % Create vector
circle = radius.*circle;    % Circle of required radius

% Calculations
cp = 1 - 4.*(sin(t)).^2;     % Pressure coefficient
cp_scaled = cp + radius;     % Attempted scaling

% Display graphs
polar(t,cp,'--r')
hold on
polar(t,circle)
hold off
figure
polar(t,cp_scaled,'--r')
hold on
polar(t,circle)
hold off
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Pretty useless now,

just in case if you ever wonder what was missing

super sky said:
I'm trying to plot the pressure distribution around a cylinder in a uniform flow field, so that the graphic is a circle with the pressure curve around it, like in the image below.
http://img843.imageshack.us/img843/4649/63792687.th.jpg

Uploaded with ImageShack.us

I have the equation for the ideal pressure coefficient Cp (which is what I'm wanting to display), and t is the theta values. (See code below)

Then I use the polar function to plot it... polar(t,Cp)... but that starts at the origin, which isn't what I want. I thought it might help if I added the radius of my proposed circle to Cp, but it doesn't. So maybe I need a scaling factor on Cp or something..?

Could someone help me out?
Thanks.

Code:
%%% Flow Around a Cylinder %%%

% Initialise variables
clear all
clc

U = 12;     % Freestream velocity m/s
M = 2;      % Doublet strength
radius = sqrt(M/2/pi/U);    % Cylinder radius
t = linspace(0,2*pi,50);    % Range of theta values
circle = ones(1,50);        % Create vector
circle = radius.*circle;    % Circle of required radius

% Calculations
cp = 1 - 4.*(sin(t)).^2;     % Pressure coefficient
[COLOR="Red"]cp_scaled = sqrt(cp.^2 + circle.^2)[/COLOR]; % the missing function

% Display graphs
polar(t,cp,'--r')
hold on
polar(t,circle)
hold off
figure
polar(t,cp_scaled,'--r')
hold on
polar(t,circle)
hold off
 
Last edited by a moderator:
  • #3
Thanks :)
I never did figure it out, so it was helpful to know in case I have to do it again.
 

1. What is Matlab and how is it used in plotting pressure distribution around a circle?

Matlab is a powerful scientific programming language and software environment used for data analysis, numerical computation, and visualization. It is commonly used in engineering, mathematics, and other scientific fields to solve complex problems and conduct simulations. In the context of plotting pressure distribution around a circle, Matlab can be used to create a visual representation of pressure values at different points on the circle, allowing for a better understanding of the pressure distribution pattern.

2. How can I plot pressure distribution around a circle in Matlab?

To plot pressure distribution around a circle in Matlab, you can use the "polarplot" function. This function takes in two arrays as inputs - one for the angle values and one for the pressure values at each angle. It then plots the pressure values as a function of the angle, creating a circular plot. You can also customize the plot by adding a title, labels, and adjusting the scale and colors.

3. Can Matlab plot pressure distribution at specific points on the circle?

Yes, Matlab allows you to specify the angle values and pressure values at specific points on the circle, and then plot the pressure distribution accordingly. This can be done by creating arrays with the desired angle and pressure values, and then using the "polarplot" function to plot the data. You can also add markers or lines to the plot to indicate the specific points.

4. How can I interpret the pressure distribution plot in Matlab?

The pressure distribution plot in Matlab represents the pressure values at different points on the circle. The distance from the center of the circle to the outer edge represents the pressure magnitude, while the angle around the circle represents the direction of the pressure. A larger distance from the center indicates a higher pressure, and the angle indicates the direction of the pressure (e.g. 0 degrees represents pressure in the positive x-direction).

5. Can I export the pressure distribution plot from Matlab?

Yes, you can export the pressure distribution plot from Matlab as an image file (such as PNG or JPEG) or as a vector graphics file (such as PDF or SVG). This can be done by using the "saveas" function in Matlab, which allows you to specify the file format and file name for the exported plot. You can then use the exported plot for presentations, reports, or further analysis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Replies
1
Views
572
  • Engineering and Comp Sci Homework Help
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
9K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
26K
  • Advanced Physics Homework Help
4
Replies
118
Views
12K
Replies
21
Views
16K
Back
Top