Error using contour function

Hello I am trying to create a streamline function using the contour function but keep recieveing an error, please help!
clear all;
clc;
xmax=10;
ymax=10;
x=linspace(-xmax,xmax,100);
y=linspace(-ymax,ymax,100);
[X,Y]=meshgrid(x,y);
m=12.94;
a=1;
U=5;
invtan=atan((2*a*y)./(x.^2+y.^2-1))
Psi=U*y-(m/(2*pi))*invtan
figure
contour(X,Y,Psi,-3:0.25:3,'B')

1 Commento

madhan ravi
madhan ravi il 11 Apr 2019
Modificato: madhan ravi il 11 Apr 2019
You forgot to use Capital X & Y after meshgrid() call, I suppose, try:
clear all;
clc;
xmax=10;
ymax=10;
x=linspace(-xmax,xmax,100);
y=linspace(-ymax,ymax,100);
[X,Y]=meshgrid(x,y);
m=12.94;
a=1;
U=5;
invtan=atan((2*a*Y)./(X.^2+Y.^2-1))
Psi=U*Y-(m/(2*pi))*invtan
figure
contour(X,Y,Psi,-3:0.25:3,'B')

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange

Prodotti

Richiesto:

il 11 Apr 2019

Modificato:

il 11 Apr 2019

Community Treasure Hunt

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

Start Hunting!

Translated by