How can i solve this eqaution in matlab?

How can i solve this eqaution in matlab?
where the X is the propellant length = 0 to 4.5 meters
clc; clear;
global Go A Rho_f P n m a Reg_dot_dt_values Reg_dot_dt_values2
Rho_f = 920; %kg/m^3
Dp = 0.152; % m
m_dot_oxi = 7.95; %kg/s
n = 0.75;
m = -0.15;
a = 2.006e-5;
Rp = Dp/2; % m
A = pi*(Rp^2); % Port area
Go = m_dot_oxi/A; % Oxidizer mass flux
P = 2*pi*Rp; % Perimeter
Reg_dot_dt_values = [];
[x,R] = ode45(@f, [0 10], 0.076);
function Reg_dot_dt = f(x,R)
global Go A Rho_f P n m a Reg_dot_dt_values Reg_dot_dt_values2
Reg_dot_dt = (a*(Go^n)*(x^m))*((1+(((1-n)*Rho_f*P*a*(x^(1+m)))/((1+m)*A*(Go^(1-n)))))^(n/1-n));
Reg_dot_dt2 = a*(Go^n).*(((1+(Rho_f*P/Go*A).*Reg_dot_dt)^(n)).*(x^m));
Reg_dot_dt_values = [Reg_dot_dt_values; Reg_dot_dt];
end

4 Comments

How can i solve this eqaution in matlab?
Which equation do you want to solve for what variable ?
The last equation which denotes local regression rate with respect to X. I am new to solving ODE's in matlab and found it little confusing
Torsten
Torsten on 11 Jun 2024
Edited: Torsten on 11 Jun 2024
And you want to get r(x) ? Is the "dot" differentiation with respect to x ?

Sign in to comment.

 Accepted Answer

Rho_f = 920; %kg/m^3
Dp = 0.152; % m
m_dot_oxi = 7.95; %kg/s
n = 0.75;
m = -0.15;
a = 2.006e-5;
Rp = Dp/2; % m
A = pi*(Rp^2); % Port area
Go = m_dot_oxi/A; % Oxidizer mass flux
P = 2*pi*Rp; % Perimeter
drdx = @(x)a*Go^n*x.^m.*(1+((1-n)*Rho_f*P*a*x.^(1+m))./((1+m)*A*Go^(1-n))).^(n/(1-n));
x = 0:0.1:50;
r = zeros(size(x));
r(1) = 0.076;
for i = 1:numel(x)-1
r(i+1) = r(i) + integral(drdx,x(i),x(i+1));
end
plot(x,[r;drdx(x)])

3 Comments

Dear Solver, I appreciate your guidance. But somewhere the output data are way off than the expected ones.
if you can refer to first table at t=0.1sec the r_dot values differ than the computed ones.
Torsten
Torsten on 11 Jun 2024
Edited: Torsten on 11 Jun 2024
You said you want r, not rdot.
And rdot is the derivative with respect to t, not with respect to x as you claimed.
I don't know how t is used in the calculation of rdot in order to get different values for rdot for different values of t.
sorry if i wasnt able to explain you okey so t is not used in calculsation its just represent port diameter in my code it represented by Rp=diameter /2. and the requirement is to find r_dot with respect to x which ranges from 0 to 4.5m as including zero will take the solution to infinity 0.381 was conisidered.

Sign in to comment.

More Answers (1)

I still don't understand where you can change t=0.1 s, t=20 s, t=60 s, but here we go:
Rho_f = 920; %kg/m^3
Dp = 0.152; % m
m_dot_oxi = 7.95; %kg/s
n = 0.75;
m = -0.15;
a = 2.006e-5;
Rp = Dp/2; % m
A = pi*(Rp^2); % Port area
Go = m_dot_oxi/A; % Oxidizer mass flux
P = 2*pi*Rp; % Perimeter
rdot = @(x)a*Go^n*x.^m.*(1+((1-n)*Rho_f*P*a*x.^(1+m))./((1+m)*A*Go^(1-n))).^(n/(1-n));
x = 0.381:0.001:4.572;
plot(x,rdot(x)*1e2)

3 Comments

SUBHAM HALDAR
SUBHAM HALDAR on 11 Jun 2024
Moved: Torsten on 11 Jun 2024
Thank you Torsten, I have understood the format of the code i need to put into. I think i need to check with the reference value. and reiterate it. Thank you for your prompt help.
Also can you how can i use ODE to solve the equation mentioned below?
Maybe you can manually simplify "sol" to get the expression from above.
I don't know why 0^(m+1) appears in the solution although m is assumed to be > -1.
syms intrdot(x)
syms c1 c2 n m real
syms a G0 rhoF P A real
assume(m>-1)
eqn = diff(intrdot,x) == c1*(1+c2*intrdot)^n*x^m;
cond = intrdot(0)==0;
sol = dsolve(eqn,cond);
sol = subs(sol,[c1 c2],[a*G0^n,rhoF*P/(G0*A)])
sol = 
thank you. for your help.

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Release

R2024a

Tags

Asked:

on 11 Jun 2024

Edited:

on 12 Jun 2024

Community Treasure Hunt

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

Start Hunting!