Solving simple equation in Matlab

  • Thread starter Inertigratus
  • Start date
  • Tags
    Matlab
In summary, the conversation discusses solving for H(f), given that f is constant and X(f) and Y(f) are column vectors with 32768 rows. The equation H(f)X(f) = Y(f) is mentioned, and the attempt at a solution involves using element-wise division, but an "Out of Memory" error is encountered. The expert suggests using './' instead of '/' for element-wise division in Matlab.
  • #1
Inertigratus
128
0

Homework Statement


I want to solve for H(f).
I know that f is supposed to be constant.
X(f) and Y(f) are both column vectors with a total of 32768 rows.

Homework Equations


H(f)X(f) = Y(f)

The Attempt at a Solution


I tried dividing, H(f) = Y(f)/X(f) but got an "Out of Memory" error.
It's not a matrix so I can't find an inverse too.
Any ideas?
I think H(f) is supposed to be a column vector as well, but since f is supposed to be constant then all entries will be the same.
Nevermind, It's simply elementwise division, but something's wrong...
 
Last edited:
Physics news on Phys.org
  • #2
Hi,

To perform element-wise division in Matlab (which I think is what you're trying to do), you must precede the forward slash with a full stop.

I.e. replace '/' with './'

Matlab performs matrix right division when the operator '/' is used, and I'm not entirely sure what that entails for two column vectors.
 

1. How do I solve a simple equation in Matlab?

To solve a simple equation in Matlab, you can use the "solve" function. This function takes in two inputs: the equation and the variable to solve for. For example, if you have the equation x + 5 = 10, you would use the command "solve(x + 5 == 10, x)" to get the value of x.

2. Can I solve multiple equations at once in Matlab?

Yes, you can solve multiple equations at once in Matlab by using the "solve" function with a system of equations. For example, if you have the equations x + y = 10 and 2x + y = 12, you would use the command "solve([x + y == 10, 2x + y == 12], [x, y])" to get the values of x and y.

3. What happens if there is no solution to the equation in Matlab?

If there is no solution to the equation in Matlab, the "solve" function will return an empty array. This indicates that there is no solution that satisfies the given equation.

4. Can I solve equations with variables other than numbers in Matlab?

Yes, you can solve equations with variables other than numbers in Matlab. However, you will need to use the "sym" function to declare the variables as symbolic before solving the equation. For example, if you want to solve the equation x + a = 10, you would use the command "solve(sym(x) + sym(a) == 10, x)".

5. Is there a way to check if my solution is correct in Matlab?

Yes, you can use the "subs" function to substitute your solution into the original equation and check if it equals to the right-hand side of the equation. If the result is true, then your solution is correct. For example, if you have the equation x + 2 = 5 and your solution is x = 3, you would use the command "subs(x + 2, x, 3)" and if the result is equal to 5, then your solution is correct.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
942
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
468
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
570
  • Linear and Abstract Algebra
Replies
19
Views
2K
Back
Top