error "Invalid first data argument."

조회 수: 11 (최근 30일)
Anas Mustafa
Anas Mustafa 2019년 6월 8일
댓글: Walter Roberson 2019년 6월 8일
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