Differential equation for matlab

Click For Summary

Discussion Overview

The discussion revolves around solving a differential equation related to the function y(t) = e^(-t)*sin(t^2) for a MATLAB project. Participants explore methods for expressing the equation in a form suitable for numerical integration, particularly using the Runge-Kutta method.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related
  • Debate/contested

Main Points Raised

  • One participant describes their attempt to derive the differential equation from the given function and expresses confusion about obtaining the correct form for MATLAB.
  • Another participant suggests the use of FFT (Fourier transforms) as a common MATLAB application for analyzing complicated signals.
  • A different participant clarifies that they are trying to approximate the differential equation using the Runge-Kutta method and emphasizes the need for the correct differential equation.
  • One reply proposes testing the MATLAB code with a simpler equation, such as integrating a sine function, to ensure the code works correctly.
  • A participant questions the origin of the function y(t) and seeks clarification on what was provided in the problem statement.
  • Another participant provides a potential expression for f(t, y) based on their calculations, but expresses uncertainty about its usefulness.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the correct form of the differential equation or the expression for f(t, y). Multiple competing views and uncertainties remain regarding the approach to solving the problem.

Contextual Notes

There are unresolved aspects regarding the initial conditions and the specific requirements for expressing the differential equation in a form compatible with MATLAB. The discussion also reflects varying levels of familiarity with MATLAB and numerical methods among participants.

cameuth
Messages
17
Reaction score
0
THE PROBLEM :

y(t) = e^(-t)*sin(t^2);
with t0 = 0 and T = 3.14159. Find y_0, and use it to deduce the corresponding expression
for f(t, y) (Your f should have both a t and a y in it. Simplify it to find the y!).

This is for a MATLAB project. I've solved this differential equation (which we get from the derivative of the problem above) , but apparently there's a way to solve it where we get y on the right hand side of the equation (and still have t's). This is the only way the code will work in matlab.

MY ATTEMPT: basically I took the derivative of y=e^(-t)*sin(t^2) to get

y'=-e^(-t)[sin(t^2)+(2t)cos(t^2)]

You then inegrate to get the original formula plus a constant

y=e^(-t)*sin(t^2)+C

Now if we apply the inital condition y(0)=0, we get the original equation. Again.

y=e^(-t)*sin(t^2)

This is not correct. What am I missing?

PS, if you want to see my code and think that will help I have that as well. Just ask. Thanks
 
Last edited:
Physics news on Phys.org
are you doing something with FFT (aka Fourier transforms) on the equation?

Thats what people often use MATLAB for given a complicated signal and use FFT to determine the component frequencies.
 
Last edited:
No, I'm trying to approximate this differential equation using the runge-kutta method, then plot the error. But, I can't really do any of that without the proper differential equation. Which is where I'm stuck.
 
Okay so given a differential equation, you want to use MATLAB to numerically integrate your equation via runge-kutta and to then compare it to an exact solution.

Have you tried a simpler equation such as integrating a sin function to get a cos function to test your MATLAB code?

To be fair, I'm not a heavy MATLAB person. I've done some numerical integration using open source physics java code where we converted the differential equation into first order differentials and I figure that's how it may need to be done here.

I did find this predator prey simulation that compares two versions of runge-kutta in plot form that may help.

http://www.mathworks.com/products/m...products/demos/shipping/matlab/lotkademo.html

http://math.arizona.edu/~emcevoy/odes.pdf
 
Last edited:
When you wrote:

[itex]y(t) = e^{-t}sin(t^2)[/itex], did you find this, or was this given to you? I'm confused. Precisely what does the problem give you?
 
So, I'm still confused about what f(t,y) is supposed to be, but I got

[itex]\dot{y} = e^{-t}(-sin(t^2)+2tcos(t^2)) = -y+2te^{-t}cos(t^2) = f(t,y)[/itex]is this useful at all?
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K