error "Invalid first data argument."

10 vues (au cours des 30 derniers jours)
Anas Mustafa
Anas Mustafa le 8 Juin 2019
Commenté : Walter Roberson le 8 Juin 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

Réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by