how to change x and y values to a range of values
조회 수: 1 (최근 30일)
이전 댓글 표시
How can i change the variables X and Y values to a range of values in the code below? Its already in a loop and i used "hold on" to keep the plots previosly so the results are combined in one graph. Thanks in advance. In the code below i used one value for X and one value for Y, but i'd like to use the Y value range that i commented in the code.
clear all
clc
Vinf=100; % Input Vinf
a=deg2rad(15); % Input Alpha in degrees
N=100; % Number of Free Vortexes
c=1; % Length of chord c
X=-2*c;
% Y=linspace(-.7*c,0.1*c,20);
Y=-.7*c;
DeltaT=4e-8;
k=nonzeros(0:c/N:1);
for i=1:length(k)
s(i)=k(i); % si
s1=k(i)-(c/N); % si-1
% s2 is the center of free vortex i
s2=(s(i)+s1)*0.5;
ai=(s2*cos(a));
bi=((-s2)*sin(a));
Thetai=acos(1-2*s(i)); % θi
Thetai_1=acos(1-2*s1); % θi-1
G1(i)=(a*Vinf)*(Thetai-Thetai_1);
G2(i)=(2*a*Vinf)*[(sqrt(s(i)-s(i).^2))-(sqrt(s1-s1.^2))];
% Stength Gi of free vortex "i"
G(i)=G1(i)+G2(i);
u(i)=(G(i)/(2*pi))*((Y-bi)/((X-ai)^2+(Y-bi)^2));
v(i)=((-G(i))/(2*pi))*((X-ai)/((X-ai)^2+(Y-bi)^2));
end
UDT=u*DeltaT;
VDT=v*DeltaT;
DD=X+UDT;
D2=Y+VDT;
plot(DD, D2,'-or')
hold on
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!