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

5 views (last 30 days)
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’)

Accepted Answer

Mischa Kim
Mischa Kim on 13 Sep 2014
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')

More Answers (1)

Sofiya
Sofiya on 13 Sep 2014
Thank u

Categories

Find more on Contour Plots 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!