0% found this document useful (0 votes)
101 views2 pages

Programa Paracaidista MATLAB

The document defines constants for mass (m), gravity (g), time (t), initial velocity (v), and number of iterations (n). It then uses the bisection method to find the root of a function between input lower (xi) and upper (xs) limits, calculating the function value at each step and updating the limits based on the sign of the function values to converge on the root. It prints the values at each iteration and calculates the percentage error to test for convergence within n iterations.

Uploaded by

Perez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views2 pages

Programa Paracaidista MATLAB

The document defines constants for mass (m), gravity (g), time (t), initial velocity (v), and number of iterations (n). It then uses the bisection method to find the root of a function between input lower (xi) and upper (xs) limits, calculating the function value at each step and updating the limits based on the sign of the function values to converge on the root. It prints the values at each iteration and calculates the percentage error to test for convergence within n iterations.

Uploaded by

Perez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

format long

m= 68.1 ;
g= 9.81 ;
t= 10 ;
v= 40 ;
xi = input('Limite inferior: ');
xs = input('Limite superior: ');
n = input('Numero de iteraciones: ');
fxi = (((g * m) /xi).*(1 - exp((-xi/m).* t))) -v;
fxs = (((g * m) /xs).*(1 - exp((-xi/m).* t))) -v;
fcom = fxi * fxs;
if fcom < 0
xr = (xi + xs) / 2;
fxr = (((g * m) /xr).*(1 - exp((-xr/m).* t))) -v;
fprintf('xi = %f xs = %f xr = %f \n',xi,xs,xr);
fcom = fxi * fxr;
if fcom > 0
xi = xr;
else
if fcom < 0
xs = xr;
else
raiz = xr;
end
end
fprintf('xi = %f xs = %f xr = %f',xi,xs,xr);
c = 2;
while c <= n
xrant = xr;
xr = (xi + xs) / 2;
ea = ((xr - xrant) / xr) * 100;
if ea < 0
ea = abs(ea);
end
c = c + 1;
fxi = (((g * m) /xi).*(1 - exp((-xi/m).* t))) -v;
fxs = (((g * m) /xs).*(1 - exp((-xs/m).* t))) -v;
fxr = (((g * m) /xr).*(1 - exp((-xr/m).* t))) -v;
fcom = fxi * fxr;
if fcom > 0
xi = xr;
else
if fcom < 0
xs = xr;
else
raiz = xr;
end
end

fprintf('\n c = %f xi = %f xs = %f xr = %f fxi = %f fxs = %f fxr


= %f error = %f',c,xi,xs,xr,fxi,fxs,fxr,ea);

end
else
disp('El metodo no aplica...');
end

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy