error "Invalid first data argument."

15 views (last 30 days)
Anas Mustafa
Anas Mustafa on 8 Jun 2019
Commented: Walter Roberson on 8 Jun 2019
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)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!