Excel - help with eulers method on coupled equations

In summary, the conversation is about a simulation on a magnetic moment in a magnetic field B. The equations involved are m'-x=B*m-y and m'-y= - B*m-x, where m-x is the x component and ' represents the rate of change with respect to time. The goal is for the vector to precess in a circle with frequency w=-B, with B set to one. However, the result is only about half a sine wave instead of a full one. The cosine term in the m'-y formula is neglected, as are the m'-z and m-z columns. The starting point is M'=M X B, with B being in the z direction. The person is struggling with their formulae
  • #1
ragga puffin
1
0
im doing a simulation on a magnetic moment in a magnetic field B and I am quite stuck.

its a set of coupled equations: m'-x=B*m-y & m'-y= - B*m-x
where m-x is the x component, ' is rate of with respect to time etc.
the vector should be precessing in a circle with frequency w= - B, B is set to one so it should make one rotation in one second -> full cycle -> full sine wave, but i seem to only be getting about half a sine wave :confused:

the cosine term in the m'-y formula can be neglected, as can the m'-z and m-z columns because the starting point is M'= M X B (the cross product of the moment and the magnetic field) and B is defined as being in the z direction.

im pretty sure the equations are right and the problem lies in my formulae in excel, any help will be greatly appreciated:!)
 

Attachments

  • NMR moment study.xls
    40 KB · Views: 281
Physics news on Phys.org
  • #2
I filled the data for mx down past 1.5 seconds and plotted it, and it looks reasonable except for the expected period that you mention. How did you derive that the period should be 1? Is there maybe a factor of PI missing? It looks like the period is actually closer to PI...
 
  • #3


First of all, it's great that you are using Excel for your simulation. It can be a powerful tool for solving complex equations. In order to troubleshoot the issue, I would recommend checking your initial conditions and the values of your parameters. Make sure that your initial values for m-x and m-y are correct and that your value for B is set to 1, as you mentioned. It's also important to double check your equations and make sure that you are using the correct variables in your spreadsheet.

Another potential issue could be the step size that you are using in your Euler's method. If the step size is too large, it can lead to inaccurate results. I would suggest trying different step sizes and seeing if that makes a difference in your simulation.

Additionally, it may be helpful to plot your results and compare them to what you expect to see. This can help you identify where the issue may be occurring. You can also try using a different numerical method, such as the Runge-Kutta method, to see if that gives you better results.

If you are still having trouble, I would suggest seeking assistance from a colleague or a professor who has experience with numerical methods and simulations. They may be able to provide additional insights and help you troubleshoot the issue.

Overall, it's important to carefully check your equations, initial conditions, and parameters to ensure that everything is correct. With some trial and error and perhaps some assistance, I'm confident that you will be able to solve the issue and get accurate results for your simulation. Good luck!
 

FAQ: Excel - help with eulers method on coupled equations

What is Euler's method?

Euler's method is a numerical method used to approximate solutions to differential equations. It involves dividing the interval of interest into smaller segments and using the slope of the tangent line at each point to estimate the next point on the curve.

How is Euler's method used for coupled equations in Excel?

In Excel, Euler's method can be used by creating a table with columns for the independent variable, the two coupled variables, and the corresponding slopes. The slope for each variable is calculated using the previous values of that variable and the other variable's value. The new values are then calculated by adding the product of the slope and the step size to the previous values.

Can Euler's method be used for any type of differential equation?

No, Euler's method is only suitable for first-order differential equations. It may also not provide accurate results for equations with steep slopes or large step sizes.

How do I determine the step size for Euler's method in Excel?

The step size for Euler's method in Excel can be determined by dividing the interval of interest by the desired number of steps. It is important to choose a small enough step size to ensure accurate results, but not so small that it causes computational errors.

Are there any alternatives to Euler's method for solving coupled equations in Excel?

Yes, there are other numerical methods that can be used for solving coupled equations in Excel, such as the Runge-Kutta method or the midpoint method. These methods may provide more accurate results than Euler's method, but they also require more computational effort.

Similar threads

Replies
6
Views
903
Replies
2
Views
3K
Replies
2
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Back
Top