How would you write this equation in MATLAB? (challenging)

  • MATLAB
  • Thread starter leealex0201
  • Start date
  • Tags
    Matlab
In summary, the conversation is about putting an equation into MATLAB to calculate the global maximum of a mutual information function. The person needs to calculate the gradient of the function, which is described in attached files. They have the necessary vectors, A and B, but are unsure of how to write the calculation in MATLAB.
  • #1
leealex0201
1
0
Hello guys,

I would like to put this equation into the MATLAB to calculate the global maximum of mutual information function. In order to do that, I notice that I need a gradient of the function which is described as in attached files.

I do have the vector for P(x) and P(x|spike). Let's say they are called A and B respectively. Then, how do I write this down in MATLAB to calculate the gradient?

FYI, A and B are 1-by-100 vectors.
 

Attachments

  • Screen Shot 2014-04-25 at 10.18.59 AM.png
    Screen Shot 2014-04-25 at 10.18.59 AM.png
    6.1 KB · Views: 543
  • Screen Shot 2014-04-25 at 10.22.30 AM.png
    Screen Shot 2014-04-25 at 10.22.30 AM.png
    3.3 KB · Views: 493
Physics news on Phys.org
  • #2
I'm sorry you are not finding help at the moment. Is there any additional information you can share with us?
 

1. How do I write a complex equation in MATLAB?

To write a complex equation in MATLAB, you can use the built-in functions such as complex or imag to create complex numbers and abs to find the absolute value of a complex number. You can also use the i or j variables to represent the imaginary unit in your equation.

2. Can I use variables in my equation in MATLAB?

Yes, you can use variables in your equation in MATLAB. You can assign values to variables using the = operator and use those variables in your equation. Make sure to use valid variable names and assign them values before using them in your equation.

3. How can I handle errors in my equation in MATLAB?

To handle errors in your equation in MATLAB, you can use try and catch blocks. The try block contains the code that might cause an error, and the catch block handles the error if it occurs. You can also use the error function to throw a specific error message.

4. Can I plot an equation in MATLAB?

Yes, you can plot an equation in MATLAB using the plot function. This function takes in the x and y values of your equation and creates a line plot. You can also customize the plot by adding labels, titles, and changing the line style and color.

5. How can I solve a system of equations in MATLAB?

To solve a system of equations in MATLAB, you can use the solve function. This function takes in the equations and the variables to solve for and returns the solutions in a symbolic form. You can also use the fsolve function to find numerical solutions to your system of equations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
827
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
997
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
569
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
Back
Top