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 CenterFile Exchange 中查找有关 Contour Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by