# How can I solve in the error?

조회 수: 1(최근 30일)
Myo Gyi 2022년 12월 20일
댓글: Myo Gyi 2022년 12월 20일
clear all, clc; % clear all memory and variables
x = linspace(-1,1); % create linear spacing in x-direction
y = linspace(-1,1); % create linear spacing in y-direction
%initialise velocity
U = 1.; %freestream velocity
%looping in i and j-directions
for i = 1:length(x)
for j = 1:length(y)
%create x & y space
xx(i,j) = x(i);
yy(i,j) = y(j);
%calculate radius from x & y
% calculate angle from x and y
if x(i) > 0
theta(i,j) = atan(y(j)/x(i));
elseif x(i) <0 && y(j) >= 0
theta(i,j) =atan(y(j)/x(i))+pi;
elseif x(i) < 0 && y(j) < 0
theta(i,j) = atan(y(j)/x(i))-pi;
elseif x(i) == 0 && y(j) < 0
theta(i,j) = pi/2;
else
theta(i,j) = pi/2;
end
% calculate stream function using polar coordinate system
% calculate velocity potential using polar coordinate system
end
end
%plotting
contourf(xx,yy,psi,-1:0.2:1,k,LineWidth,1.5), hold on % plot stream function for range -1:0.1:1
contour(xx,yy,phi,-1:0.2:1,r,LineWidth,1.5) % plot velocity potential for range -1:0.2:1
axis image, hold off
legend(streamlines,potential)
title(Uniform stream in x-direction)
xlabel(x-coordinate), ylabel(y-coordinate)
axis square;
% end of Octave program
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Myo Gyi 2022년 12월 20일
Thank you sir... Can You repair for my code sir.

댓글을 달려면 로그인하십시오.

### 답변(1개)

Stephan 2022년 12월 20일
%clear all, clc; % clear all memory and variables
x = linspace(-1,1); % create linear spacing in x-direction
y = linspace(-1,1); % create linear spacing in y-direction
%initialise velocity
U = 1.; %freestream velocity
%looping in i and j-directions
for i = 1:length(x)
for j = 1:length(y)
%create x & y space
xx(i,j) = x(i);
yy(i,j) = y(j);
%calculate radius from x & y
% calculate angle from x and y
if x(i) > 0
theta(i,j) = atan(y(j)/x(i));
elseif x(i) <0 && y(j) >= 0
theta(i,j) =atan(y(j)/x(i))+pi;
elseif x(i) < 0 && y(j) < 0
theta(i,j) = atan(y(j)/x(i))-pi;
elseif x(i) == 0 && y(j) < 0
theta(i,j) = pi/2;
else
theta(i,j) = -pi/2;
end
% calculate stream function using polar coordinate system
% calculate velocity potential using polar coordinate system
end
end
%plotting
contourf(xx,yy,psi,-1:0.2:1,'k','LineWidth',1.5), hold on % plot stream function for range -1:0.1:1
contour(xx,yy,phi,-1:0.2:1,'r','LineWidth',1.5) % plot velocity potential for range -1:0.2:1
axis image, hold off
legend('streamlines','potential')
title('Uniform stream in x-direction')
xlabel('x-coordinate'), ylabel('y-coordinate')
axis square; ##### 댓글 수: 1표시숨기기 없음
Myo Gyi 2022년 12월 20일
Thanks Sir.... Can I get more pitcure like this side
https://people.utm.my/ridhwan/teaching/skme-3333-aerodynamics/potential-flow/

댓글을 달려면 로그인하십시오.

### 범주

Find more on Matrices and Arrays 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!