# Solving a highly non linear equation in Matlab

8 Ansichten (letzte 30 Tage)
Wissem-Eddine KHATLA am 4 Apr. 2022
Beantwortet: MOSLI KARIM am 18 Aug. 2022
I would like to ask for some advices in order to solve numerically a highly non-linear differential equation that represents a height field measured on an experiment. This is the equation :
I would like to know :
• How realistic it would be to solve this equation numerically on Matlab ?
• What kind of tool can I use in order to do so ?
• Which kind of strategy would be efficient in order to solve it ?
Best regards,
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Sam Chak am 4 Apr. 2022
Bearbeitet: Sam Chak am 4 Apr. 2022
Okay @Wissem-Eddine KHATLA, please type out the highly nonlinear ODE in MATLAB code first.
1. You can realistically solve the ODE in MATLAB and obtain the solution with a relatively good accuracy using a smaller step size.
2. Technically, there are various of ODE solvers and I think you can use the ode45 solver for this case.
3. The strategy as described in the examples in the link: https://www.mathworks.com/help/matlab/ref/ode45.html

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Torsten am 4 Apr. 2022
Bearbeitet: Torsten am 4 Apr. 2022
It's "only" an ODE of degree 6.
Rewrite it as a system of first-order ODEs. You will need 6 initial or boundary conditions.
Depending on whether these conditions are set in one or two points, use ode45,ode15s as solvers for initial value problems or bvp4c as a solver for boundary value problems.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (2)

John D'Errico am 4 Apr. 2022
Bearbeitet: John D'Errico am 4 Apr. 2022
This is a differential equation. An ODE, because it involves derivatives wrt only one variable. It is high order, and nonlinear, so there will surely be NO analytical solution available. So do not even bother trying to use a tool like dsolve.
Convert the problem into a system of 6 ODE's. You can see examples of how to do so in the docs for tools like ODE45.
Finally, consider that NO solution can be obtained unless you have 6 initial conditions. This is because, as I said above, no analytical solution will be found. So you need 6 conditions, essentially on the function value and its derivatives.
Then you just call a tool like ODE45.
Note that if all of this seems to be completely meaningless to you, a complete foreign language, then you need to spend some time learning about ODEs (Ordinary Differential Equations).
Is it solvable? Probably so. In MATLAB, or in ANY computational environment, that is entirely up to you, and to the the time you will invest in it, and your skill at working with ODEs. Will it take some effort? Probably, and that is true no matter where you try to solve it, and what tools you use. There are many tools and methods that can be used to solve ODEs. Surely some of them will work on your problem.
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
MOSLI KARIM am 18 Aug. 2022
here is my proposal for your problem
here is my proposal for your problem
Unrecognized function or variable 'here'.
function ODE_ordre6
tspan=[1 10];
y0=[1;1;1;1;1;1];
option=odeset('relto',1*10^-6);
[eta,F]=ode45(@fct,tspan,y0,option );
eta
F
plot(eta,F(:,1),'r-o',eta,F(:,2),'o-b',eta,F(:,3),'y-o',eta,F(:,4),'g-o',eta,F(:,5),'k-o',eta,F(:,6),'c-o')
xlabel('\eta')
ylabel('F')
legend('F','F(:,1)','F(:,2)','F(:,3)','F(:,4)','F(:,5)','F(:,6)')
% table(F1,F2,F3,F4,F5,F6
function dxdy=fct(eta,y)
dxdy=[y(2);y(3);y(4);y(5);y(6);((5*y(1)-4*eta*y(2)-3*(y(2)^2)*y(6))/y(1))];
end
end

Melden Sie sich an, um zu kommentieren.

MOSLI KARIM am 18 Aug. 2022
here is my proposal for your problem
Unrecognized function or variable 'here'.
%%%%%%%%%%%%%%%%%% CODE MATLAB
function ODE_ordre6
tspan=[1 10];
y0=[1;1;1;1;1;1];
option=odeset('relto',1*10^-6);
[eta,F]=ode45(@fct,tspan,y0,option );
eta
F
plot(eta,F(:,1),'r-o',eta,F(:,2),'o-b',eta,F(:,3),'y-o',eta,F(:,4),'g-o',eta,F(:,5),'k-o',eta,F(:,6),'c-o')
xlabel('\eta')
ylabel('F')
legend('F','F(:,1)','F(:,2)','F(:,3)','F(:,4)','F(:,5)','F(:,6)')
% table(F1,F2,F3,F4,F5,F6
function dxdy=fct(eta,y)
dxdy=[y(2);y(3);y(4);y(5);y(6);((5*y(1)-4*eta*y(2)-3*(y(2)^2)*y(6))/y(1))];
end
end
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Eigenvalue Problems finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by