limits are too large

96 次查看(过去 30 天)
i have parametrized surface equation T(u,v)=e^(u^2+v^2) i + ln(2*v) j + tan(5*u) k . I used this code to plot it in 3D but it gives error 'limits are too large '. can yu help me pls.
clc; clear all ;
M = 100 ; N = 100 ;
uinf = 100 ;
u = linspace(0,uinf,M) ;
v = linspace(0,2*pi,N) ;
[U V] = meshgrid(u,v) ;
X = exp(U.^2+V.^2) ;
Y = log(2.*V) ;
Z = tan(5*U) ;
surf(X,Y,Z) ;

采纳的回答

Image Analyst
Image Analyst 2019-4-21
Try this:
clc;
clear all;
M = 100;
N = 100;
u = linspace(0,.1,M);
v = linspace(0,.2,N);
[U, V] = meshgrid(u,v);
X = exp(U.^2+V.^2);
Y = log(2.*V);
Z = tan(5*U);
surf(X,Y,Z, 'EdgeColor', 'none');
xlabel('X');
ylabel('Y');
zlabel('Z');
0000 Screenshot.png

更多回答(2 个)

Walter Roberson
Walter Roberson 2019-4-20
X contains values up to +infinity . Y contains values as smal as -infinity . surf() cannot draw with X and Y coordinates that large.
Your u is as large as 100 and your v is as large as 2*pi, so U^2+V^2 is as large as 10000+4*pi^2 . You take exp() of that, and that overflows. It is a number that is approximately 10^451.

dpb
dpb 2019-4-20
K>> format short
K>> sum(X(:)>1E100)/numel(X)
ans =
0.8499
K>> sum(X(:)>1E200)/numel(X)
ans =
0.7848
K>> sum(X(:)>1E300)/numel(X)
ans =
0.7383
K>> sum(X(:)>1E301)/numel(X)
ans =
0.7371
K>> sum(X(:)>1E302)/numel(X)
ans =
0.7362
K>> sum(X(:)>1E305)/numel(X)
ans =
0.7344
K>> sum(X(:)>1E307)/numel(X)
ans =
0.7334
K>> sum(isinf(X(:)))/numel(X)
ans =
0.7329
K>> sum(isfinite(X(:)))/numel(X)
ans =
0.2671
K>>
Your X value is "blowing up" beyond limits of what can hold in double precision...pare down the upper limits of u,v to something reasonable.

类别

Help CenterFile Exchange 中查找有关 Cartesian Coordinate System Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by