How Can MATLAB Automatically Solve and Apply Values in Equations?

In summary, the conversation is about finding a way to use MATLAB to solve the equation P*v = 1*8.314*T for T, given the values of P and v. The person attempted to use the solve function but it did not work because it is symbolic and cannot be set to an anonymous function. Instead, they suggest manually rearranging the equation to solve for T.
  • #1
GreenPrint
1,196
0
SOLVED

Homework Statement



Hello,

I was wondering if someone could please tell what functions are required to solve this problem. I was trying to solve P*v = 1*8.314*T for T were P=[2494 1247 831 623 499 416]; and v=1:6; I was trying to come up with a series of commands that would compute the value of T and plug in the first value of P and the 1st value of v then go on to the second values, third values, fourth values... Is there any way this is possible? Note that I know how to solve the equation for T by myself but I was wondering if there was anyway I could get MATLAB to do it for me and then plug in the values on it's on and present the 6 values of temperature

Please let me know if this makes no sense, I hope it does

Code:
disp('(a)')
v=1:6;
P=[2494 1247 831 623 499 416];
temperature= @(v,P) solve('1*8.314*T-P*v','T');
temperature(v,P)

I was trying to do something like that but that obviously wouldn't work becuase solve('1*8.314*T-P*v','T'); is symbolic and I can't set it to an anonymous function and then plug in the v and P values

Homework Equations


The Attempt at a Solution

 
Last edited:
Physics news on Phys.org
  • #2
Why don't you just rearrange that equation (manually) to make T the subject of the formula?
 

What is MATLAB and how does it solve equations?

MATLAB is a programming language and software environment commonly used in scientific and engineering fields. It has built-in functions and tools for solving mathematical equations and systems of equations.

How do I input equations into MATLAB?

To input equations into MATLAB, you can use the symbolic math toolbox or define variables and use operators and functions to represent the equation. You can also use the command line to define and manipulate symbolic variables and functions.

What methods does MATLAB use to solve equations?

MATLAB uses a variety of numerical and symbolic methods to solve equations. These include root-finding algorithms, linear algebra methods, and differential equation solvers.

Can MATLAB solve any type of equation?

MATLAB is capable of solving a wide range of equations, including linear, polynomial, transcendental, and differential equations. However, the complexity and accuracy of the solutions may vary depending on the equation and the method used.

How can I check the accuracy of the solutions in MATLAB?

MATLAB provides functions and tools for evaluating the accuracy of the solutions obtained. You can compare the solutions to known values, use analytic methods to check for errors, or use built-in functions such as "fzero" to find the roots of an equation with high precision.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
14
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
955
  • Engineering and Comp Sci Homework Help
Replies
16
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
11
Views
2K
  • Advanced Physics Homework Help
Replies
6
Views
310
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
4
Views
609
  • Engineering and Comp Sci Homework Help
Replies
9
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
894
Back
Top