Matlab Apoyo
Matlab Apoyo
clc
clear all
g = 9.8;
Vo = input('Data_Vo ');
teta = input('Data_teta ');
H = input('Data_H ');
teta = teta*3.1416/180;
t = (Vo*sin(teta)) + ((Vo*sin(teta))^2 + 2*H*g)^0.5/g;
xmax = Vo*cos(teta)*t;
ymax = H + ((Vo*sin(teta))^2)/(2*g);
t1 = [0:0.05:t];
xmax = Vo*cos(teta)*t1;
y = H + (Vo*sin(teta)).*t1-(0.5*g).*(t1.^2);
X = Vo*cos(teta).*t1;
y2 = H + (tan(teta).*X) - (0.5*g/(Vo*cos(teta))^2).*(X.^2);
figure(1),plot(t1,y,'*'), title('Graf Y vs
t'),xlabel('t[segund]'),ylabel('Y[mts]')
figure(2),plot(X,y2,'r*'), title('Graf Y vs
X'),xlabel('X[metrs]'),ylabel('Y[metrs]')
FUNCTION GRAPHIC
~
clc
clear all
x = 0:pi/120:4*pi;
y = sin(x);
for i=1:length(x)
plot(x(i),y(i),'*','LineWidth',2);
hold on
plot(x(1:i),y(1:i),'LineWidth',2);
axis([0 4*pi,-2 2]);
pause(0.01);
if i~=length(x)
clf
end
end
RESORTE
Xo = 90;
Vo = 100;
k = 1.5;
m = 7.5;
g = 9.8;
R = 0.35;
for t=0:0.0005:5
a=(-k*Xo/m)-g-(R*Vo/m)
Vo = Vo+a*t;
Xo = Xo+Vo*t;
plot(t,Xo,'kp')
hold on
grid on
pause(0.0005)
end
syms x y
fxy = -2*x^3+12*x^2-20*x+8.5
x0 = 0;
y0 = 1;
h = 0.5;
n = 10;
M = zeros(n,2);
for i=1:n
y_ast = double(y0+h*subs(fxy,[x y],[x0 y0]));
y_sig = double(y0+h*(subs(fxy,[x y],[x0 y0])+subs(fxy,[x y],[x0+h
y_ast]))/2);
x0 = x0+h;
y0 = y_sig;
M(i,1)=x0;
M(i,2)=y0;
end
disp('los valores de x e y son:')
M
plot(M(:,1)',M(:,2)','r*')
function X=Susty(C)
n=length(C)-1;
m=n+1;
X(n)=C(n,m)/C(n,n)
for i=n-1:-1:1
suma=C(i,m);
for j=i+1:n
suma=suma-C(i,j)*X(j);
end
X(i)=suma/C(i,i);
end
for i=1:n
fprintf('x(%2.0f) %5.5f\n',i, X(i))
end