Extremely basic question for MATLAB's solve()

  • Context: MATLAB 
  • Thread starter Thread starter BilalX
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the use of MATLAB's solve() function, particularly in the context of solving equations symbolically when variables are defined as doubles. Participants explore issues related to obtaining explicit solutions and the integration of numerical values into symbolic equations.

Discussion Character

  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • One participant expresses confusion about using the solve() function with symbolic equations and notes that it returns a warning when attempting to solve without substituting numerical values.
  • Another participant suggests that different toolboxes in MATLAB may not be compatible, indicating a potential limitation in combining symbolic and numerical computations.
  • A later reply proposes using the subs command to substitute variables with their defined values before solving, providing a method to work around the issue of obtaining explicit solutions.
  • The same reply acknowledges that while their solution works, there may be more elegant approaches available.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best method to solve the problem, as there are differing views on the compatibility of toolboxes and the effectiveness of the proposed solutions.

Contextual Notes

Limitations include the potential incompatibility of different MATLAB toolboxes and the need for explicit numerical substitution in symbolic equations, which may not be universally applicable.

Who May Find This Useful

This discussion may be useful for MATLAB users, particularly those working with symbolic mathematics and seeking to understand the nuances of the solve() function and variable substitution.

BilalX
Messages
7
Reaction score
0
Hello,

Although I recently had a MATLAB class it didn't really touch on variable types or use of the solve() function, and now I'm stumped on an embarrassingly basic problem; I'm trying to solve an equation in this form, with the other variables defined as doubles:

solve('Dy*sin(Cy*atan(By*alpha1-Ey*(By*alpha1-atan(By*alpha1))))+Svy=2131','alpha1')

This returns an "Explicit solution could not be found" warning and an empty answer set. From what I've been able to gather, the command attempts to solve the equation symbolically, and it works fine when I manually replace the variables with their numerical values, e.g:

solve('2119.16*sin(1.2739*atan(11.981*alpha1-0.0012*(11.981*alpha1-atan(11.981*alpha1))))+27.6617=2131','alpha1')

Could anyone tell me how to make the command work without having to explicitly enter the numerical values?
 
Physics news on Phys.org
I think they use two different tool boxes, so they can't really be mashed together. I tried to do this the other day but couldnt.
 
Any solutions for this issue?
 
perhaps a bit late, but I have an answer to your question. as I was looking into it myself and needed an answer as well.
You can use the subs command to enter your variables.

DyS = some formula
ByS =
SvyS =
EyS =
CyS =

Eq='Dy*sin(Cy*atan(By*alpha1-Ey*(By*alpha1-atan(By*alpha1))))+Svy=2131';

subs(Eq,Dy,DyS);
subs(Eq,By,ByS);
subs(Eq,Svy,SvyS);
subs(Eq,Ey,EyS);
subs(Eq,Cy,CyS);

solve(Eq,'alpha1')
% or [alpha1] = solve(Eq,'alpha1')

There may be a more elegant solution, but this works.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
11K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
15K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K