MatLab code for these Integrals.

In summary, the conversation is about how to write proper language for integrals in MatLab. The person is struggling with writing code for MonteCarlo method in MatLab for their scientific research. They are seeking advice on how to handle integrals in MatLab and looking for help with understanding the problem.
  • #1
John Mark
3
0
How can I write proper language for these integrals in MatLab ?
Your helps really appreciated.



John Mark
 

Attachments

  • Integrals.pdf
    107.1 KB · Views: 299
Physics news on Phys.org
  • #2
Those integrals are:##\renewcommand{\dy}{\text{d}y} \renewcommand{\dx}{\text{d}x}##

1) $$\iint e^{-(x^4+y^4)}\;\dx\dy$$ 2) $$\iint e^{-(x^4+y^4)}(x^2+y^2)x^2y^2e^{-2x^2y^2}\;\dx\dy$$

What have you tried?
How would you normally handle integrals in matlab?
i.e. what's the trouble you are having here?

(Otherwise it just looks like a couple of homework problems.)
 
  • Like
Likes 1 person
  • #3
I need to write the code of solutions by MonteCarlo method in MatLab for my scientific research. These are the integrals which I'm struggling with.
 
  • #4
Have you had a look how MATLAB normally gets used to simulate monte-carlo?
http://www.mathworks.com/discovery/monte-carlo-simulation.html
http://www.columbia.edu/~mh2078/MCS04/MCS_overview.pdf
http://physics.gac.edu/~huber/envision/instruct/montecar.htm

How would you normally handle integrals in matlab?

Basically, I still don't know where your problem lies.
If you don't tell me, I cannot help you.

i.e. in a Monte Carlo sim, would want to evaluate a radius ... which is ##r^2=x^2+y^2## ?
Have you realized that ##(x^2+y^2)^2=x^4+y^4+2x^2y^2## ?
 
  • #5
, thank you for reaching out. I am happy to assist you with writing proper language for integrals in MatLab. To write integrals in MatLab, you can use the "integral" function. This function takes in two arguments: the function you want to integrate and the limits of integration. For example, if you want to integrate the function f(x) from 0 to 1, you would write "integral(f, 0, 1)". Additionally, you can also use the "syms" function to define symbolic variables and then use the "int" function to integrate with respect to those variables. I hope this helps. Let me know if you have any further questions. Best of luck with your code!
 

FAQ: MatLab code for these Integrals.

1. What is MatLab code?

MatLab code is a programming language used for technical computing. It is often used in scientific and engineering applications to solve complex mathematical problems.

2. How do I write MatLab code for integrals?

To write MatLab code for integrals, you will need to use the "integral" function. This function takes in an expression and the limits of integration and returns the numerical value of the integral. You can also use the "syms" function to define symbolic variables and integrate them using the "int" function.

3. Can I integrate multiple variables using MatLab?

Yes, MatLab allows you to integrate multiple variables using the "int" function. You can specify the variables you want to integrate with respect to as well as the limits of integration.

4. Are there any built-in functions for solving definite integrals in MatLab?

Yes, MatLab has a built-in function called "integral" specifically designed for solving definite integrals. It takes in an expression and the limits of integration and returns the numerical value of the integral.

5. How do I plot the graph of an integral in MatLab?

To plot the graph of an integral in MatLab, you can use the "fplot" function. This function takes in an expression and the limits of integration as its arguments and plots the graph of the integral. You can also use the "ezplot" function for plotting simple integrals.

Similar threads

Replies
4
Views
3K
Replies
32
Views
3K
Replies
5
Views
2K
Replies
5
Views
890
Replies
5
Views
2K
Replies
8
Views
746
Replies
10
Views
2K
Back
Top