solve() only gives one of infinitely many solutions.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145961/image.jpeg)
Hopefully the screenshot will make my question clear. From what I can tell by looking at the documentation for the solve() function, this application of solve is Supposed to give a parametrization for All solutions to x*y=1, but I only get one.
There are no additional assumptions on my variables x,y. Code in the screenshot was immediately preceded by clearing all variables.
Arthur
0 Kommentare
Antworten (2)
Zoltán Csáti
am 4 Nov. 2014
Your mistake is that you applied == instead of =. Do this one:
solution = solve('x*y=1','x','y');
Sean de Wolski
am 4 Nov. 2014
The problem is that you're asking for a solution for both variables. Instead, solve for one at a time:
solve(x*y==1,x)
ans =
1/y
2 Kommentare
Sean de Wolski
am 4 Nov. 2014
That's what it's doing: 1/y is the solution for all x given all y.
If you want to substitute in new values, use subs to do this.
subs(expr,old,new)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!