Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-11-23, 08:41 PM   #1
高级会员
 
注册日期: 2019-11-21
帖子: 2,897
感谢他人: 0
有 0 帖获得 0 感谢
声望力: 60
poster 正向着好的方向发展
默认 what is the meaning of y(i,j) and x(i,j) in the code below?

in this code below i am simulating the flow over the sphinx of ibiza and the pyramd i am trying to make the code in python but i am not understanding what is the meaning of y(i,j) and x(i,j) in the iteration loop i tried to make a for loop for x and y but it seems that i am a straight streamline can someone help?

close all; clear; clc; disp('Part b') %% V_inf=25; %uniform flow C_s=2; %circulation of vortices around sphynx C_p=3.25; %circulation of vortices around pyramid %% coordinates of vortices S_1=[13.966 0.2359]; S_2=[13.7464 0.7247]; S_3=[14.0353 1.062]; S_4=[14.3243 1.2803]; S_5=[14.0657 1.2803]; S_6=[13.8827 1.8382]; S_7=[13.67 2.2322]; S_8=[13.1772 2.6921]; S_9=[12.2791 2.8433]; S_10=[11.6264 2.8433]; S_11=[11.3163 2.4508]; S_12=[11.3127 1.9264]; S_13=[11.2179 1.4682]; S_14=[11.3474 1.0634]; S_15=[11.3127 0.5757]; S_16=[11.1604 0.1907]; P_1=[7.9398 0.5117]; P_2=[7.4442 0.9823]; P_3=[6.9758 1.4271]; P_4=[6.5624 1.8197]; P_5=[6.1236 2.2364]; P_6=[5.7148 2.6248]; P_7=[4.9071 1.9994]; P_8=[4.1875 1.4424]; P_9=[3.3127 0.7654]; P_10=[2.5914 0.2072]; %% iteration loop [x,y]=meshgrid(0:0.1:20,0:0.05:10); for i=1:length(x) for j=1:length(y) PSI(i,j)=-V_inf*y(i,j)-(C_s/2*pi).*log(sqrt((x(i,j)-S_1(1)).^2+(y(i,j)-S_1(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_1(1)).^2+(y(i,j)+S_1(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_2(1)).^2+(y(i,j)-S_2(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_2(1)).^2+(y(i,j)+S_2(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_3(1)).^2+(y(i,j)-S_3(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_3(1)).^2+(y(i,j)+S_3(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_4(1)).^2+(y(i,j)-S_4(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_4(1)).^2+(y(i,j)+S_4(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_5(1)).^2+(y(i,j)-S_5(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_5(1)).^2+(y(i,j)+S_5(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_6(1)).^2+(y(i,j)-S_6(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_6(1)).^2+(y(i,j)+S_6(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_7(1)).^2+(y(i,j)-S_7(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_7(1)).^2+(y(i,j)+S_7(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_8(1)).^2+(y(i,j)-S_8(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_8(1)).^2+(y(i,j)+S_8(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_9(1)).^2+(y(i,j)-S_9(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_9(1)).^2+(y(i,j)+S_9(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_10(1)).^2+(y(i,j)-S_10(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_10(1)).^2+(y(i,j)+S_10(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_11(1)).^2+(y(i,j)-S_11(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_11(1)).^2+(y(i,j)+S_11(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_12(1)).^2+(y(i,j)-S_12(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_12(1)).^2+(y(i,j)+S_12(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_1(1)).^2+(y(i,j)-P_1(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_1(1)).^2+(y(i,j)+P_1(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_2(1)).^2+(y(i,j)-P_2(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_2(1)).^2+(y(i,j)+P_2(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_3(1)).^2+(y(i,j)-P_3(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_3(1)).^2+(y(i,j)+P_3(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_4(1)).^2+(y(i,j)-P_4(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_4(1)).^2+(y(i,j)+P_4(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_5(1)).^2+(y(i,j)-P_5(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_5(1)).^2+(y(i,j)+P_5(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_6(1)).^2+(y(i,j)-P_6(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_6(1)).^2+(y(i,j)+P_6(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_7(1)).^2+(y(i,j)-P_7(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_7(1)).^2+(y(i,j)+P_7(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_8(1)).^2+(y(i,j)-P_8(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_8(1)).^2+(y(i,j)+P_8(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_9(1)).^2+(y(i,j)-P_9(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_9(1)).^2+(y(i,j)+P_9(2)).^2))-(C_p/2*pi).*log(sqrt((x(i,j)-P_10(1)).^2+(y(i,j)-P_10(2)).^2))+(C_p/2*pi).*log(sqrt((x(i,j)-P_10(1)).^2+(y(i,j)+P_10(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_13(1)).^2+(y(i,j)-S_13(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_13(1)).^2+(y(i,j)+S_13(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_14(1)).^2+(y(i,j)-S_14(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_14(1)).^2+(y(i,j)+S_14(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_15(1)).^2+(y(i,j)-S_15(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_15(1)).^2+(y(i,j)+S_15(2)).^2))-(C_s/2*pi).*log(sqrt((x(i,j)-S_16(1)).^2+(y(i,j)-S_16(2)).^2))+(C_s/2*pi).*log(sqrt((x(i,j)-S_16(1)).^2+(y(i,j)+S_16(2)).^2)); end end %% figures [v,u] = gradient(PSI,1,1); figure(1) quiver(x(1:8:size(x,1),1:8:size(x,1)),y(1:8:size(y,1),1:8:size(y,1)),u(1:8:size(u,1),1:8:size(u,1)),-v(1:8:size(-v,1),1:8:size(-v,1)),3); hold on contour(x,y,PSI,100); figure(2) contour(x,y,PSI,100);

更多...
poster 当前离线   回复时引用此帖
回复

主题工具
显示模式

发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码
Trackbacks are 禁用
Pingbacks are 禁用
Refbacks are 禁用



所有时间均为北京时间。现在的时间是 06:42 AM


Powered by vBulletin
版权所有 ©2000 - 2021,Jelsoft Enterprises Ltd.

SEO by vBSEO ©2009, Crawlability, Inc.