Solving a Second Order Nonlinear Differential Equation with Matlab

  • Context: MATLAB 
  • Thread starter Thread starter dmg_80
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around solving a second-order nonlinear differential equation using Matlab, specifically focusing on the equation's formulation, numerical solution, and plotting results. Participants explore methods for transforming the equation, using Matlab functions, and extracting specific data points from the solution.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant presents a second-order nonlinear differential equation and requests assistance in solving it using Matlab, including plotting and finding local maxima.
  • Another participant suggests transforming the equation into a system of first-order differential equations and provides a basic outline for implementing this in Matlab.
  • Some participants emphasize the importance of consulting Matlab documentation for guidance on solving differential equations and using built-in functions like ode45.
  • There is a recurring challenge regarding the participant's ability to understand and utilize Matlab documentation effectively, particularly due to language barriers and time constraints.

Areas of Agreement / Disagreement

Participants generally agree on the need to consult Matlab documentation for solutions, but there is disagreement regarding the adequacy of the advice given, with some expressing frustration over the perceived lack of support.

Contextual Notes

Participants express varying levels of familiarity with Matlab, and there are indications of language barriers that may affect comprehension of technical documentation.

Who May Find This Useful

Graduate students in engineering or related fields, particularly those seeking assistance with numerical methods and Matlab programming for differential equations.

dmg_80
Messages
5
Reaction score
0
someone helps me please!

Hello all,

This is the first time I've stumbled across this site, but it appears to be extremely helpful. I am an elettronic engineering grad student, and in my research, I have run across the following 2nd order non linear differential equation. It is of the form:

x'' + x = sinwt + s(x)

where s(x) = abs(5*x+1)-abs(5*x-1) (saturation)
and t=(0 2000)
and w=[0:0.001:2.^0.5] (it's a variable )

My questions are :
1) How can I write and solve this problem using Matlab ?
2) How can I plot this differential equation as a function of w ?
after the plot, How can I find the max Local (Relative) Maxima and put these results in another graph always considering them as a function of w ?

I hope there's someone who helps me...
thanks
 
Physics news on Phys.org
If you wanted to know how to solve that equation, I could tell you. Unfortunately, I know nothing about using Matlab.
 
HallsofIvy said:
If you wanted to know how to solve that equation, I could tell you. Unfortunately, I know nothing about using Matlab.

Thank you...but i have to solve this problem only using matlab...
 
Hey

First you need to transform your problem to a system of (two) first order differential equations by the substitution
x_{1}=x
and
x_{2}=x'

You will then get a problem of the type
x'_{1}=x_{2}, x'_{2}=f(x)


After that create a m-file containing

function xprim=xprim(t,x)
xprim=[x_2;f(x)]​

When try to use the function ode45 or some other solver to solve problem.
and use plot to plot the result
 
I have another problem :
I have to find, after solving that differential equation,a vector based only with the maximum values of its results...After that i have to plot this vector as a fuction of w...how can i do that ? :confused:
 
dmg_80 said:
I have another problem :
I have to find, after solving that differential equation,a vector based only with the maximum values of its results...After that i have to plot this vector as a fuction of w...how can i do that ? :confused:

Let me give you some invaluable advice: read the Matlab documentation. It's superb, and explains in detail how to approach such basic problems.
 
shoehorn said:
Let me give you some invaluable advice: read the Matlab documentation. It's superb, and explains in detail how to approach such basic problems.

Thank you for your "invaluable advice"...:rolleyes:
 
dmg_80 said:
Thank you for your "invaluable advice"...:rolleyes:

You're enrolled in an electronic engineering graduate programme but are incapable of using the detailed examples given by typing 'doc ode45'? Sounds like the advice I gave you really would be invaluable if only you'd take it.

Ninety-five percent of the time, a question about Matlab is answered in the Matlab documentation. For instance, precisely all of your questions are answered, with examples, in the documentation. Use it. It'll give you a better answer than anyone here can.
 
shoehorn said:
You're enrolled in an electronic engineering graduate programme but are incapable of using the detailed examples given by typing 'doc ode45'? Sounds like the advice I gave you really would be invaluable if only you'd take it.

Ninety-five percent of the time, a question about Matlab is answered in the Matlab documentation. For instance, precisely all of your questions are answered, with examples, in the documentation. Use it. It'll give you a better answer than anyone here can.


it's hard for me twice : first of all i haven't time to study all the Matlab documentation and second I'm an italian girl that not understand english very well..i'm trying to do it by myself...trying to traslate all i read...so please don't kidding me ...
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K