I've got this code and I want it to show the position in x and y and other things but the problem is that it show the string 'Distancia Horizontal' and 'Distancia Vertical' correctly but it repeats the values of x and y, i.e. they accumulate.
while n<100 n = n + 1 t = 0:n x=((vi*cos(angulo))/b)*(1-(e.^(-b*t))); y=((1/b)*((g/b)+vi*sin(angulo))*(1-e.^(-b*t))-((g/b)*t))+altura; hold on plot(x,y) title('Simulacion proyectiles Popocatepetl'); xlabel('Distancia Horizontal (m)'); ylabel('Distancia Vertical (m)'); str = {'Posicion en X' x,'Posicion en Y' y}; dim = [.2 .5 .3 .3]; delete(a) a=annotation('textbox',dim,'String',str,'FitBoxToText','on'); drawnow; pause(1) grid on if y<0 n=0 end end
And the message:
Best Answer