You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
How to solve a second degree derivative with another variable
2 views (last 30 days)
Show older comments
(M)'' + N*M= 0;
Is it possible to solve the above equation if N is not a constant ?
16 Comments
Jan
on 31 Jan 2018
Maybe? Please decide this clearly.
Post more details by editing the question. Write down explicitly, what you want to solve, not just the rough formulation with the two characters N and M, but the real functions you have. Convert the 2nd order equation to a system of 1st order equations.
John D'Errico
on 31 Jan 2018
This is not a question about MATLAB at all, but simple mathematics. As such, there is no reason to post it on MATLAB Answers. Worse, it is very unclear, even after several responses by you in the comments as to what the real problem is.
However I'll point out that if you have a differential equation in the form posed, where both M(t) and N(t) are unknown functions, then no, a single differential equation is insufficient to infer the relations M(t) AND N(t).
If N depends on another variable x, then again, you CANNOT predict the relationship N(x) if that relationship is unknown.
If however, N(x) is a known function, then for ANY value of x, just predict N(x), and THEN solve the ODE, which is now a constant coefficient ODE, and in this example trivial to solve.
Dereje
on 31 Jan 2018
But N is NOT a constant, if it is, it would be simple for me that the equation becomes harmonic and the solution for a source with an initial M0 is something like : M0cos(Nt)+sin(Nt)/N.
Dereje
on 31 Jan 2018
Numerically I was not sure about the solution for the equation, that is why I said maybe. But in both ways it would be very helpful for me.
Torsten
on 31 Jan 2018
If N does not depend on t (or another quantity that depends on t), what does it depend on if it's not constant ?
Dereje
on 31 Jan 2018
This is N:
zval= [2 3 5 7 10 15 20 25 30 40 50 60 70 80 90 100 125 150 160 175 200 225 250 275 300 325 350 375 400];
rho1 = [17.2731684 17.1649375 21.43455647 22.4140625 23.86332207 24.3746967 24.70487685 24.6003125 24.8933125 25.42772826 26.03220776 26.439625 26.8151875 26.86830797 27.1949375 27.34406944 27.5551875 27.728625 27.23423729 27.88542857 27.752249049 28.1025 28.2415 28.37 28.05366667 28.6565 28.7755 28.898 29.013];
rho0=29;
g=9.8;
zvala=400-zval;
zvalue=fliplr(zvala);
rho2=fliplr(rho1);
rho3=smoothdata(rho2,'lowess',6);
rho=interp1(zvalue,rho3,z);
rho4=interp1(zvalue,rho3,z+0.1);
N=(-g./rho0).*(rho4-rho);
Here is I used ODE to calculate M
%if
function parameters=rhs(z,v)
alpha=0.099;
dV= 2*alpha*v(2);
dM= (v(1).*v(3))./(2*v(2)^3);
dF= -N.*v(1);
parameters=[dV;dM;dF];
end
Dereje
on 31 Jan 2018
Here is I want a time derivative of M. And N is an external data which depend on the input data above.
Torsten
on 1 Feb 2018
Form what you wrote above, I suspect that both M and N only depend on z and a variable t is not involved. Thus your equation would read
M''(z)+N(z)*M(z)=0
Is this correct ?
Best wishes
Torsten.
Dereje
on 1 Feb 2018
Like you said M which is a momentum depends on z(depth). And N is a density profile which varies on Z and it's calculation is like I put is above. Now I wanted to get a result of M (Momentum) when it varies with time not z. The original equation is: d(F)/d(t)=-N*N*M and d(M)/d(t) =F Now combining the two gives (M)''(with dt) + N*NM=0;
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)