Changing from circle to an ellipse

3 次查看(过去 30 天)
Tariq
Tariq 2014-6-26
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,

回答(1 个)

Image Analyst
Image Analyst 2014-6-26
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 个评论
Image Analyst
Image Analyst 2014-6-26
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]);

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by