Solving nonlinear second order diferential equation

조회 수: 9 (최근 30일)
Rafael Pessoa
Rafael Pessoa 2020년 10월 12일
편집: Stephan 2020년 10월 19일
Dados iniciais
clear
Massa_foguete_seco = 3000; % Kg
Massa_combustivel_inicial = 3000; % kg
Empuxo = 300000; % Newton (sentido de y)
Consumo_combustivel = 100; % Kg/segundo
C_arrasto = 50; % Newton/(metros/segundo)
Gravidade = 9.81; % Metros/segundo^2 (sentido contrario de y)
rho = 2; % Kg/metros cubicos
Area_secao = 15; % Metros quadrados

Peso do Foguete.
syms y(t) t
Massa_combustivel = Massa_combustivel_inicial - Consumo_combustivel * t;
Massa_foguete = Massa_combustivel + Massa_foguete_seco;
Peso_foguete = Massa_foguete * -Gravidade;

Cálculo da Aceleração
Forca_arrasto = -0.5 * C_arrasto * rho * Area_secao * diff(y,t)^2;
Forca_empuxo = Empuxo;
Peso = Peso_foguete;
Forca_resultante = Forca_arrasto + Forca_empuxo + Peso;

Equações do movimento
Aceleracao = Forca_resultante/ Massa_foguete
ode = diff(y,t,2) == Aceleracao;
dy = diff(y);
cond1 = y(0) == 0;
cond2 = dy(0) == 0;
cond = [cond1 cond2];
Altitude = dsolve(ode,cond)
Velocidade = diff(Altitude);
Aceleracao = diff(Altitude,2);

답변 (1개)

Stephan
Stephan 2020년 10월 15일
%% Dados iniciais
clear
Massa_foguete_seco = 3000; % Kg
Massa_combustivel_inicial = 3000; % kg
Empuxo = 300000; % Newton (sentido de y)
Consumo_combustivel = 100; % Kg/segundo
C_arrasto = 50; % Newton/(metros/segundo)
Gravidade = 9.81; % Metros/segundo^2 (sentido contrario de y)
rho = 2; % Kg/metros cubicos
Area_secao = 15; % Metros quadrados
%% Peso do Foguete.
syms y(t)
Massa_combustivel = Massa_combustivel_inicial - Consumo_combustivel * t;
Massa_foguete = Massa_combustivel + Massa_foguete_seco;
Peso_foguete = Massa_foguete * -Gravidade;
%% Cálculo da Aceleração
Forca_arrasto = -0.5 * C_arrasto * rho * Area_secao * diff(y,t)^2;
Forca_empuxo = Empuxo;
Peso = Peso_foguete;
Forca_resultante = Forca_arrasto + Forca_empuxo + Peso;
%% Equações do movimento
Aceleracao = Forca_resultante/ Massa_foguete;
ode = diff(y,t,2) == Aceleracao
%% Solve numerically
[eqs, vars] = odeToVectorField(ode);
odefun = matlabFunction(eqs,'vars',{'t','Y'})
tspan = [0 5];
init = [0 0];
[t,y] = ode45(odefun,tspan,init);
plot(t,y)
  댓글 수: 2
Rafael Pessoa
Rafael Pessoa 2020년 10월 18일
THANK U, it worked, but how can i derivate this function? and why there are two lines in the graphic?
Stephan
Stephan 2020년 10월 18일
편집: Stephan 2020년 10월 19일
This is a numerical solution. One line represents the velocity, the other the way. Since this is a second order system, which is transformed into a first order system of 2 ode, you get the solution to both, the way and the velocity.
See here also:
To calculate the acceleration from the results use:
%% Dados iniciais
clear
Massa_foguete_seco = 3000; % Kg
Massa_combustivel_inicial = 3000; % kg
Empuxo = 300000; % Newton (sentido de y)
Consumo_combustivel = 100; % Kg/segundo
C_arrasto = 50; % Newton/(metros/segundo)
Gravidade = 9.81; % Metros/segundo^2 (sentido contrario de y)
rho = 2; % Kg/metros cubicos
Area_secao = 15; % Metros quadrados
%% Peso do Foguete.
syms y(t)
Massa_combustivel = Massa_combustivel_inicial - Consumo_combustivel * t;
Massa_foguete = Massa_combustivel + Massa_foguete_seco;
Peso_foguete = Massa_foguete * -Gravidade;
%% Cálculo da Aceleração
Forca_arrasto = -0.5 * C_arrasto * rho * Area_secao * diff(y,t)^2;
Forca_empuxo = Empuxo;
Peso = Peso_foguete;
Forca_resultante = Forca_arrasto + Forca_empuxo + Peso;
%% Equações do movimento
Aceleracao_num = Forca_resultante/ Massa_foguete;
ode = diff(y,t,2) == Aceleracao_num;
%% Solve numerically
[eqs, vars] = odeToVectorField(ode);
odefun = matlabFunction(eqs,'vars',{'t','Y'});
tspan = [0 5];
init = [0 0];
[t,y] = ode45(odefun,tspan,init);
% Calculate acceleration from numeric solution - Create ab function handle
% that represents the acceleration ode, but now we know the numeric
% solution for the ode system, so we can use the velocity informations
% needed in the original ode.
Aceleracao_num = @(t,Y2) -(981*t - 750*Y2.^2 + 241140)./(100*t - 6000);
% Calculate those values based on the results from ode45 and also save them
% in y-vector, column 3
y(:,3) = Aceleracao_num(t,y(:,2));
% plot the whole system, with y, y_dot and y_doubledot
plot(t,y)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by