Errors while using animated fplot3
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Oscar García
il 5 Apr 2017
Risposto: Walter Roberson
il 6 Apr 2017
Hi, I want to do an animation of rotating 3d parametric curves. I tried with fplot3 and the first example of this page https://es.mathworks.com/help/matlab/ref/hgtransform.html. But I can only plot a graph at a time. My code is below, first plot is a helix and second one a circle, if use both i get this error
Error using matlab.graphics.function.ParameterizedFunctionLine/set Invalid or deleted object.
Error in untitled3 (line 17) set(h,'Parent',t)
¿What I am doing wrong?
ax = axes('XLim',[-1.5 1.5],'YLim',[-1.5 1.5],'ZLim',[-1.5 1.5]);
view(3)
grid on
[x,y,z] = cylinder([.2 0]);
xt = @(t) 0.75*sin(t);
yt = @(t) 0.75*cos(t);
zt = @(t) t;
ht = @(t) 0;
h(1) = fplot3(xt,yt,zt,[-pi pi]);
%h(2) = fplot3(ht,yt,xt,[-pi pi]);
t = hgtransform('Parent',ax);
set(h,'Parent',t)
Rz = eye(4);
for r = 0:.1:2*pi
Rz = makehgtform('zrotate',r);
set(t,'Matrix',Rz)
pause(0.1);
drawnow
end
0 Commenti
Risposta accettata
Walter Roberson
il 6 Apr 2017
hold(ax, 'on')
After the axes call. It needs to be before the fplot3 call or else the fplot3 will erase the axes including getting rid of the grid and view
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Animation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!