4D trajectory in Matlab

Hej, I am very new to Matlab and have no programming experience
I would like to obtain 3D trajectory of nuclear motion playing in time. For now I entered a code:
function [] = plotFunc(nc) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here x=nc(1,:); y=nc(2,:); z=nc(3,:);
for i=1:length(x) plot3(x(i),y(i),z(i), '-rs', 'LineWidth',3)
pause(0.2)
hold on
plot3(x,y,z, '-m', 'LineWidth',0.5)
grid on
xlabel('x')
ylabel('y')
zlabel('z')
axis([80 95 30 50 0 20])
M(:,i) = getframe
end
movie(M) save M
It gives me a line and points appear over it in time (it would be better if it drew the trajectory from scratch but it's not my main concern. if u can offer help on that it would also be greatly appreciated though). Now I want to save this animation in some useful format. I used qtwrite command (qtwrite(M)) but it returns an error: ??? Undefined function or method 'qtwrite' for input arguments of type 'struct'.
Do u have any suggestions of how to get this animation?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 12 de Mzo. de 2011

0 votos

Please clarify which version of Matlab you are using, and which OS you are on. qtwrite() existed in Matlab 4, but by Matlab 5 was only available on the Mac (and only worked with colormaps of size 64.)
With very new Matlab there is the VideoWriter class.
You may be able to create AVI

1 comentario

Paulina
Paulina el 13 de Mzo. de 2011
I am using Matlab on my Mac version 7.11.0 (R2010b)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Animation en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by