Solve for intercepts in nonlinear eq

I have these equations and need to solve them in matrix form and find the two intercepts. i was able to do this with linear eq but cant figure it out with nonlinear. my equations are y = 4 - ((x^2)/2) and y/2 = log10(x+8)

댓글 수: 3

madhan ravi
madhan ravi 2020년 6월 19일
Hmm nice , knew you would do this. Why waste others time ?
Ameer Hamza
Ameer Hamza 2020년 6월 19일
Original Question:
Title: Solve for intercepts in nonlinear eq
Text: I have these equations and need to solve them in matrix form and find the two intercepts. i was able to do this with linear eq but cant figure it out with nonlinear. my equations are y = 4 - ((x^2)/2) and y/2 = log10(x+8)
Rena Berman
Rena Berman 2020년 10월 12일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

답변 (2개)

Ameer Hamza
Ameer Hamza 2020년 6월 19일

1 개 추천

This equation does not have a closed-form solution. Therefore, you can solve it using fsolve() or vpssolve() if you have symbolic toolbox since this equation has two solutions. The following code shows a way to get both roots by manually specifying a good initial guess.
syms x y
eq1 = y == 4 - ((x^2)/2);
eq2 = y/2 == log10(x+8);
y1 = solve(eq1, y);
y2 = solve(eq2, y);
eq = y1 == y2;
sol1 = vpasolve(eq, 2)
sol2 = vpasolve(eq, -2)

댓글 수: 4

Sarah Smith
Sarah Smith 2020년 6월 19일
Thank you!! do you know how i would do this if i wanted to solve for the intersection of the those equaitions but also y = x and y = (x+2)/2? So 4 equations total for a the solution
If the solution of four equations exist, the it can be find using following code
syms x y
y1 = 4 - ((x^2)/2);
y2 = 2*log10(x+8);
y3 = x;
y4 = (x+2)/2;
y_sol = vpasolve(std([y1 y2 y3 y4]))
Sarah Smith
Sarah Smith 2020년 6월 19일
I get the error "Empty sym: 0-by-1"
Which MATLAB release are you using. The symbolic toolbox with R2020a is able to give a solution (y_sol=2). Alternatively, you can try a numerical solver
syms x y
y1 = 4 - ((x^2)/2);
y2 = 2*log10(x+8);
y3 = x;
y4 = (x+2)/2;
y = std([y1 y2 y3 y4]);
fun = matlabFunction(y);
y_sol = fsolve(fun, 0);

댓글을 달려면 로그인하십시오.

Nipun Agarwal
Nipun Agarwal 2020년 6월 19일

0 개 추천

Hey,
You cannot solve Non-linear equations with the Matrix form. Matrix form can be used to solve linear equations only. You need to write your own solver or if you have MATRIX Optimization toolbox installed then you can do it with the help of fsolve. Refer this link for more info on fsolve and its applications.

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

질문:

2020년 6월 19일

댓글:

2020년 10월 12일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by