Changing from circle to an ellipse

1 view (last 30 days)
Tariq
Tariq on 26 Jun 2014
Commented: Image Analyst on 26 Jun 2014
Hello,
I have a program to determine the pressure distribution around a circle or cylinder, but I need to change the equation for the program to determine the pressure distribution around an ellipse. I have tried to change the equation, but I couldn't reach the solution. Here is the code for cylinder:
npanels=8;
r=1;
winf=1;
da = 2*pi/npanels;
z=r*exp(i*[da:da:2*pi]);<---------------------------For cylinder
a=[1:npanels];
b=[2:npanels 1];
dzds=(z(b)-z(a))./abs(z(b)-z(a));
What I need is to change to an ellipse using the equations below:
r=sqr(x^2+y^2);
y=sqr(b^2-b^2*x^2/b^2)
% where ra=3, rb=1
% the equation for an ellipse is:
x^2/a^2+y^2/b^2=1
Can anyone help in this problem.
Thank you,

Answers (1)

Image Analyst
Image Analyst on 26 Jun 2014
It's sqrt(), not sqr(). See the FAQ for how to make an ellipse: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_ellipse.3F
  1 Comment
Image Analyst
Image Analyst on 26 Jun 2014
Tariq's "Answer" moved here since it's not an answer to his original question:
here is what I did, but it is still not working:
npanels=18;
da = 2*pi/npanels;
winf=1;
x=[-3:0.1:3];
y=sqr(b^2-b^2*x^2/b^2);
th=atan(x/y);
r=sqr(x^2+y^2);
z=r*exp(i*[th]);

Sign in to comment.

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!