error "Invalid first data argument."

13 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by