Matlab Function not displaying all the answer
Mostrar comentarios más antiguos
Hey, I'm having trouble with a function. I'm required to calculate (using a function) the displacement (da), the veloctiy (va) and the accleration (aa) of a system. What I can't get the function to do is display all 3 of these answers when I run the function. The only answer that is shown after running the function is the displacement. My first line of coding is [da, va, aa] = myfinda (theta_rad) The rest of the code is the equations to work out the 3 values. Thanks!
Respuestas (1)
Image Analyst
el 9 de Abr. de 2013
Either leave off the semicolon when you compute it, or use fprintf(). Below I do it both ways:
da = 1.2345
va = 2.345676789
aa = pi*42
fprintf('Displacement = %.3f.\nVelocity = %.3f.\nAcceleration = %.5f.\n',...
da, va, aa);
In the command window:
da =
1.2345
va =
2.3457
aa =
131.9469
Displacement = 1.234.
Velocity = 2.346.
Acceleration = 131.94689.
2 comentarios
Simon Moseley
el 9 de Abr. de 2013
Image Analyst
el 9 de Abr. de 2013
Then please mark it as Answered if we're done. Thanks.
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!