error "Invalid first data argument."
15 views (last 30 days)
Show older comments
Hello there,
I'm loosing my mind here, in the below code i keep getting the error "Invalid first data argument." . But if I replace
char((get(handles.input_funcx3d, 'string'))
by any function like "x^2-1" the code works perfectly, please help me solve this
the code is for plotting solid of revolution:
f = @(x) char((get(handles.input_funcx3d, 'string'))); g = @(x) (x.^3-5)*3;
t =linspace(str2double(get(handles.from_x3d, 'string')),str2double(get(handles.to_x3d, 'string')),41)';
v = linspace (0,2*pi,41);
plot(f(t),g(t)), axis equal % plane curve
[U, V] = meshgrid(t, v);
X = f(U).*cos(V); Y = f(U).*sin(V); Z = g(U);
N = 24;
for n = 0 : N; % preparing animation
mesh(X, Y, Z); hold on; axis equal;
plot3(f(t)*cos(n*2*pi/N), f(t)*sin(n*2*pi/N), g(t));
hold off; pause(0.2);
end
thanks
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!