Differential equation problem with Matlab

In summary, the differential equation has two unknowns, y and z, and two knowns, x and vekt. The unknowns are solved for using the ODE45 function, and the results are plotted on a graph. The equation has an antiderivitive that must be found in order to solve for dy/dx and dz/dx.
  • #1
damightytom
17
0
1. Solve the differential equation

y=10, dy/dx=0 when x=0
z=15, dz/dx=0 when x=0

d2y/dx2 = - 2y/3 + (z – y)/3
d2z/dx2 = -(z – y)

plot y,z,dydx,dzdx doe x=0->10

Homework Equations



I am having trouble getting my head around the problem.
I need help setting a variable for dy/dx and dz/dx in my function for ODE45 to find the value.


The Attempt at a Solution



So after setting up my script as such
[y z] = ode45('fun',[0 10], vekt);

vekt being the vector for all values at x=0

I need to set up my function so ODE has something to work with.
I know what to do when I have d/dx in the equation since you can set dy/dx = z and then d2y/dx2 = y'. But now I have a value for dydx at x=0 but I don't have that in the equation.

So I'm at a loss.
Anyone can give me any pointers?
 
Physics news on Phys.org
  • #3
Thanks for the heads up, but the main problems for me is to understand what I should do with dydx and dzdx that can't be found in the equation but have a value at x=0
 
  • #4
Do I have to find the antiderivitive for d2y/dx2 in order to get dy/dx and then solve it?

Or is there some kind of trick into getting dy/dx in the equation?
 
  • #5
damightytom said:
Do I have to find the antiderivitive for d2y/dx2 in order to get dy/dx and then solve it?

Or is there some kind of trick into getting dy/dx in the equation?

Remember that numerical solvers for ODEs work on solving first order ODEs only. How would you transform the second equation to give you first order ODEs only?
 
  • #6
d2z/dx2 = -(z – y)

z''=-(z-y)

q=[y';y'']

y(1)=z''
y(2)=z'

Can I do something like that so I have ekv=y(2); -(z-y) for the second equation?

I'm out in very deep water, I would kinda know what to do if I saw dy/dx in the equations, but now I don't so I'm pretty much guessing.
 

What is a differential equation?

A differential equation is a mathematical equation that describes the relationship between a function and its derivatives. It is often used to model changes in physical systems over time.

How can Matlab be used to solve differential equations?

Matlab has built-in functions and tools for solving differential equations, including the "ode" suite of functions. These functions use numerical methods to approximate the solutions to differential equations.

What are the advantages of using Matlab for differential equations?

Matlab allows for quick and accurate solving of differential equations, and it also has visualization tools that can help understand the behavior of the solutions. It also allows for easy manipulation of parameters and initial conditions.

What are the limitations of using Matlab for differential equations?

Matlab can only approximate the solutions to differential equations, so it may not always provide exact solutions. It also requires a good understanding of numerical methods and how to choose appropriate settings for the functions.

Can Matlab handle all types of differential equations?

No, Matlab has limitations on the types of differential equations it can handle. It is best suited for ordinary differential equations (ODEs) and may struggle with partial differential equations (PDEs) or stiff systems of equations.

Similar threads

  • Calculus and Beyond Homework Help
Replies
6
Views
695
  • Calculus and Beyond Homework Help
Replies
2
Views
669
  • Calculus and Beyond Homework Help
Replies
8
Views
708
  • Calculus and Beyond Homework Help
Replies
10
Views
1K
  • Calculus and Beyond Homework Help
Replies
24
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
261
  • Calculus and Beyond Homework Help
Replies
2
Views
645
  • Calculus and Beyond Homework Help
Replies
7
Views
641
  • Calculus and Beyond Homework Help
Replies
15
Views
979
  • Calculus and Beyond Homework Help
Replies
7
Views
508
Back
Top