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

2 Ansichten (letzte 30 Tage)
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’)

Akzeptierte Antwort

Mischa Kim
Mischa Kim am 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')

Weitere Antworten (1)

Sofiya
Sofiya am 13 Sep. 2014
Thank u

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by