limits are too large
69 views (last 30 days)
Show older comments
Kuatra Patil
on 20 Apr 2019
Commented: Kuatra Patil
on 21 Apr 2019
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) ;
0 Comments
Accepted Answer
Image Analyst
on 21 Apr 2019
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');
More Answers (2)
Walter Roberson
on 20 Apr 2019
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.
0 Comments
dpb
on 20 Apr 2019
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.
0 Comments
See Also
Categories
Find more on Cartesian Coordinate System Conversion 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!