Matlab - plot pressure distribution around a circle

Click For Summary
SUMMARY

This discussion focuses on plotting the pressure distribution around a cylinder in a uniform flow field using MATLAB. The user aims to visualize the pressure coefficient Cp in a polar plot but encounters issues with the plot starting at the origin instead of the desired circle. The solution involves using the equation cp_scaled = sqrt(cp.^2 + circle.^2) to correctly position the pressure curve around the cylinder. The provided MATLAB code initializes variables such as freestream velocity and doublet strength, and effectively calculates and displays the pressure distribution.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of polar plotting functions in MATLAB
  • Knowledge of fluid dynamics concepts, specifically pressure coefficients
  • Basic mathematical skills for manipulating equations
NEXT STEPS
  • Explore MATLAB's polar plotting capabilities in detail
  • Study fluid dynamics principles related to pressure distribution
  • Learn about the implementation of scaling factors in graphical representations
  • Investigate advanced MATLAB functions for visualizing complex data
USEFUL FOR

Engineers, researchers, and students in fluid dynamics or computational fluid dynamics who are interested in visualizing pressure distributions using MATLAB.

super sky
Messages
3
Reaction score
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
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
cp_scaled = sqrt(cp.^2 + circle.^2); % 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:
Thanks :)
I never did figure it out, so it was helpful to know in case I have to do it again.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 11 ·
Replies
11
Views
9K
  • · Replies 6 ·
Replies
6
Views
26K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 21 ·
Replies
21
Views
18K
  • · Replies 1 ·
Replies
1
Views
20K
  • · Replies 27 ·
Replies
27
Views
3K