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

2 visualizaciones (últimos 30 días)
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’)

Respuesta aceptada

Mischa Kim
Mischa Kim el 13 de Sept. de 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')

Más respuestas (1)

Sofiya
Sofiya el 13 de Sept. de 2014
Thank u

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by