Matlab Function Help: Find Value of x with Y

In summary, the person is seeking help with finding the value of vector x based on the value of vector y. They tried using the interp1 function but it did not work. They are asking if there is another function that can be used. The person also mentions not knowing about vector y and needing to solve an equation to find yi and then xi. They were asked for more information to understand the problem and why they are stuck.
  • #1
jayki
6
0
Hi frenz

i ve a vector x. based on the value of Y, i need to find the value of x.
i tried to do that with interp1 function modifying it but itz no use.
is there any function which can b used?
 
Physics news on Phys.org
  • #2
did you try switching the oreder of the variables in interp...
 
  • #3
Matlab

but i know only vecor x. i donno about vector y. by solving an equation i wil get yi from that i need to find xi
 
  • #4
I'm afraid I can't understand what you're trying to do, or why you're stuck. Can you give us more information?

- Warren
 

FAQ: Matlab Function Help: Find Value of x with Y

What is a Matlab function?

A Matlab function is a block of code that performs a specific task and can be called multiple times throughout a program. It helps to organize and simplify complex tasks, making the code more efficient and readable.

How do I find the value of x with y in Matlab?

To find the value of x with y in Matlab, you can use the "solve" function. This function takes in an equation or a system of equations and solves for the specified variable. For example, if you have the equation x + 2 = 5 and you want to find the value of x when y = 5, you can use the command "solve(x + 2 == 5, x)" which will return x = 3.

What if my equation has multiple solutions?

If your equation has multiple solutions, the "solve" function will return all possible solutions. You can also specify a range of values for the variable to narrow down the solutions. For example, if you want to find the value of x in the equation x^2 = 4, you can use the command "solve(x^2 == 4, x, 'Real', true)" to only return real solutions and "solve(x^2 == 4, x, [0 10])" to limit the solutions between 0 and 10.

Can I use the "find" function to find the value of x with y?

Yes, the "find" function can also be used to find the value of x with y in Matlab. However, this function is more commonly used to locate specific values or elements in a matrix or array. It may not be as efficient as the "solve" function for solving equations.

Are there any other ways to find the value of x with y in Matlab?

Yes, there are other ways to find the value of x with y in Matlab. You can use numerical methods, such as the bisection or Newton's method, to approximate the solution of an equation. You can also use the "fzero" function to find the root of an equation, which can be helpful for non-linear equations. However, these methods may require more coding and may not always provide a precise solution.

Similar threads

Replies
2
Views
1K
Replies
4
Views
1K
Replies
2
Views
3K
Replies
11
Views
2K
Replies
10
Views
2K
Replies
8
Views
649
Replies
2
Views
3K
Back
Top