Solving system of equations
이전 댓글 표시
Hi,
I am trying to solve a system of equations. This system is comprised of 4 first-order differential equations and 4 analytical equations, I have 8 unknown variables. Each equation is dependent on at least 2 different variables. Is there a way to solve such a system of equations? I know of the bvp4c function that I could use for the differential equations because I know the boundary conditions. But in order to solve these, I need to include the analytical equations somehow. Any ideas?
Thanks!
댓글 수: 12
darova
2020년 2월 25일
WHERE
ARE
EQUATIONS?
Nrmn
2020년 2월 27일
darova
2020년 2월 27일
Do you have hose equtions of paper or LaTeX format? It's hard to read this as code
I have a question:
- Is it possible re-write 3d and 4th equations as? You didn't describe Y_e and Y_h. Are they constants?
% The third and fourth differential equations are as follows:
% d/dx(h_0e*m_e*n_e*u_e*A) = Y_e
% d/dx(h_0h*m_h*(n_n+n_e)*u_n*A) = Y_h
(h_0e*m_e*n_e*u_e*A) = Y_e*x
(h_0h*m_h*(n_n+n_e)*u_n*A) = Y_h*x
darova
2020년 2월 28일
Thank you for explanations and LaTeX formulas
Can you please attach all data you have? All constants, parameters and so on
darova
2020년 2월 28일
Below are parameters, function and initial conditions necessary for solving
(deal( 1 ) means assigning 'one' to all variable)
% where delta, gamma, m_e, A are constants.
[delta, gamma] = deal( 1 );
% where m_e, q, k_B, A are constants,
[m_e, q, k_B, A] = deal( 1 );
% where D_ins, B_01, sigma_cex are constants, sigma_ion = f(T_e)
[D_ins, B_01, sigma_cex] = deal( 1 );
[M_h, u_e, u_h, T_h, T_e, n_n, n_e] = deal( 1 );
[nu_en, m_h, Y_h] = deal( 1 );
[dT_e, dn_e] = deal( 1 );
[L_st, D_st] = deal( 1 );
f = @(x) 1;
darova
2020년 3월 1일
I'm stil waiting. Wanna know something
Nrmn
2020년 3월 2일
darova
2020년 3월 2일
Energy?

Nrmn
2020년 3월 2일
darova
2020년 3월 2일
I mean values ;)
Is there any data? Or it's function?
Nrmn
2020년 3월 2일
답변 (1개)
darova
2020년 3월 2일
Here is algorithm i choosed:
- integrate 3 and 4 equations. Get 2 nonlinear equations
- having 6 nonlinear equations (red box) use fsolve to calculate unknown u_e u_h T_h T_e n_n n_e
- calculate M_h and V

I places these equations into ode45 function. I got some results. BUt how to know if they are correct?
I choosed Y_h=1 and Y_e=1 (couldn't handle it)
After constructing system of equations (RED BOX) i put there initial conditions
% u_e u_h T_h T_e n_n n_e
u0 = [18032, 30.0623, 4500, 1.37, 1.6218E+22, 1.4459E+21);
EQNS(u0,1,1)
ans =
1.0e+03 *
0.0016
-0.0008
0.0098
0.0000
-0.0001
-2.6002
% shouldn't all they be zero?
See attached script
댓글 수: 8
Nrmn
2020년 3월 4일
darova
2020년 3월 4일
u vector is [integral(Y_h) integral(Y_e) M_h V]
du = [Y_h; Y_e; dM_h; dV];
I first wanted to understand if this works so i didn't write boundary conditions at x=0.75mm
DO you understand how ode45 works? Is it clear for you?
Do you have any data to compare with? I have no idea if results are close to solution
Do you understand how system of equations (EQNS) is written? Did you try to pass some values?
Nrmn
2020년 3월 4일
darova
2020년 3월 4일
clc,clear
% some simple syste of equations
F = @(x) [2*x(1) - 1
x(2)/2 - 3]
opt = optimset('display','off');
x0 = fsolve(F,[1 1],opt)
% if i pass (put inside) roots of equations
% all should be zero
F(x0)
I re-wrote all equations to be solved as follows. If all parameters are correct EQNS should return zeros

Some usefull tips:
- Use %% for creating of sections. Move caret between them and press Ctrl+Enter to run part of code

- Run code until specific line (create breakpoint F12)

Nrmn
2020년 3월 7일
darova
2020년 3월 7일
Only M_h and V are changing
Very simplified version of first six equations ( 1)-6) )
Imagine these lines in a loop (nothing changes after first interation)
x1 = fsolve(@(x)x-2,x0); % x1 = 2 now
x0 = x1; % x0 = 2 now
Analytical equations don't depend on M_h nor V
That is why RES variable doesn't change. In another words
x1 = fsolve(@(x)F(x),x0); % no M_h or V. So x1 are always the same
dM_h = func(x1, M_h);
I'd approximate Y_h as:
iY_h1 = (h_0h1*m_h*(n_n1+n_e1)*u_h1*A);
iY_h0 = (h_0h0*m_h*(n_n0+n_e0)*u_h0*A);
Y_h = (iY_h1-iY_h0)/dx;
Mh plot V plot

Doesn't look that bad
darova
2020년 3월 16일
how is it going
Nrmn
2020년 3월 20일
카테고리
도움말 센터 및 File Exchange에서 Boundary Value Problems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







