Escolar Documentos
Profissional Documentos
Cultura Documentos
j=1 %contador
tempo (j)= 0
p(j)= p0
while tempo(j)<tmax
j=j+1;
tempo(j)=tempo(j-1)+1;
p(j)=p(j-1)+n*p(j-1)-k*(p(j-1).^2)
end
plot(tempo,p)
____________________________________________________________________________
6.
v0=input ('Velocidade');
alpha=input ('Introduza o ngulo de sada');
g=10
alpha=alpha*(pi/180);
v0y=v0*sin(alpha);
v0x=v0*cos (alpha);
tvoo=(2*v0y)/g;
tempo=0;
while tempo<tvoo;
tempo=tempo+(tvoo/100);
x=v0x*tempo;
y=v0y*tempo-1/2*g*tempo^2;
plot (x,y);
hold on
end
______________________________________________________________________________
7.
% Srgio Ramos
% N. a20094977
clc
clear all
% Bloco de entrada de dados
v1=input ('Introduza o Valor da Velocidade Inicial ' );
v2=input ('Introduza o Valor da Velocidade Inicial ' );
v3=input ('Introduza o Valor da Velocidade Inicial ' );
teta1=input ('Introduza o Valor do ngulo de Lanamento ') ;
%Caso o valor do ngulo no esteja compreendido entre 0 e 90. aparece a
%mensagem de erro
if teta1<=0 || teta1>=45
error ('O valor do ngulo de lanamento deve estar entre 0 e 45');
end
% Definir o teta 2 e teta 3
teta2=90-teta1;
teta3=45;
%Converter os ngulos para Radianos
teta1=teta1*(pi/180);
teta2=teta2*(pi/180);
teta3=teta3*(pi/180);
y0=0;
x0=0;
v1x0=v1*cos(teta1);
v1y0=v1*sin(teta1);
v2x0=v2*cos(teta2);
v2y0=v2*sin(teta2);
v3x0=v3*cos(teta3);
v3y0=v3*sin(teta3);
g=9.8;
dt=0.001; % passo temporal
t1(1)=0;
y1(1)=y0;
x1(1)=x0;
t2(1)=0;
y2(1)=y0;
x2(1)=x0;
t3(1)=0;
y3(1)=y0;
x3(1)=x0;
i=1;
while y1(i)>=0;
t1(i+1)=t1(i)+dt;
y1(i+1)=y0+v1y0*t1(i+1)-1/2*g*t1(i+1)^2;
x1(i+1)=x0+v1x0*t1(i+1);
i=i+1;
end
i=1;
while y2(i)>=0;
t2(i+1)=t2(i)+dt;
y2(i+1)=y0+v2y0*t2(i+1)-1/2*g*t2(i+1)^2;
x2(i+1)=x0+v2x0*t2(i+1);
i=i+1;
end
i=1;
while y3(i)>=0;
t3(i+1)=t3(i)+dt;
y3(i+1)=y0+v3y0*t3(i+1)-1/2*g*t3(i+1)^2;
x3(i+1)=x0+v3x0*t3(i+1);
i=i+1;
end
plot(x1,y1,x2,y2,x3,y3)
grid on