Why is it always showing an error as phi is an undefined function for input argument type char ??

2 ビュー (過去 30 日間)
U = 1; % Uniform stream % GRID: x = -2:.02:2; y = -2:.02:2; for m = 1:length(x) for n = 1:length(y) xx(m,n) = x(m); yy(m,n) = y(n); % Velocity potential function: phi UniFlow(m,n) = U * x(m); % Stream function: psi UniFlow(m,n) = U * y(n); end end % Plots % Uniform stream in x direction: contour(xx,yy,psi UniFlow,[-2:.5:2],’k’),hold on contour(xx,yy,phi UniFlow,[-10:1:5],’r’) axis image,hold off title(’Uniform stream in x direction’) xlabel(’x’),ylabel(’y’)

採用された回答

Mischa Kim
Mischa Kim 2014 年 9 月 13 日
Sofiya, in your code above some of the variable names contain empty spaces (if the copy-paste worked), which is not valid. E.g.
phi UniFlow
needs to be changed to, e.g.,
phi_UniFlow
Check out:
U = 1; % Uniform stream % GRID:
x = -2:.02:2;
y = -2:.02:2;
for m = 1:length(x)
for n = 1:length(y)
xx(m,n) = x(m);
yy(m,n) = y(n); % Velocity potential function:
phi_UniFlow(m,n) = U * x(m); % Stream function:
psi_UniFlow(m,n) = U * y(n);
end
end % Plots % Uniform stream in x direction:
contour(xx,yy,psi_UniFlow,[-2:.5:2],'k'),
hold on
contour(xx,yy,phi_UniFlow,[-10:1:5],'r')
axis image
hold off
title('Uniform stream in x direction')
xlabel('x')
ylabel('y')

その他の回答 (1 件)

Sofiya
Sofiya 2014 年 9 月 13 日
Thank u

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by