constantly receiving an error undefined function or variable z when use solve
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Maria Giulia
am 4 Jan. 2020
Kommentiert: Stephen23
am 4 Jan. 2020
I was trying to find the intersection points of these function
f1=sym('y=x^3');
f2=sym('x^2+y^2=1');
S=solve(f1,f2,x,y);
solx=eval(S.x);
soly=eval(S.y);
I can't do eval(S.x) because i receive the error
Undefined function or variable 'z'.
1 Kommentar
Stephen23
am 4 Jan. 2020
Do not use eval on symbolic expressions:
https://www.mathworks.com/matlabcentral/answers/400718-need-help-with-vector-and-eval#comment_568074
Akzeptierte Antwort
Fabio Freschi
am 4 Jan. 2020
Bearbeitet: Fabio Freschi
am 4 Jan. 2020
Polynomials with a degree greater than 4 do not have explicit solutions. You can use vpa
syms x y
f1 = y == x^3
f2 = x^2+y^2==1;
S = solve([f1, f2],x,y);
vpa(S.x)
vpa(S.y)
Or double if you accept a double result
double(S.x)
double(S.y)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numbers and Precision 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!