필터 지우기
필터 지우기

Solve equation without symbolic math toolbox

조회 수: 113 (최근 30일)
Benoit
Benoit 2014년 3월 19일
답변: Benoit 2014년 3월 20일
Hello ,
I'm trying to solve this equation : 0 = (U/r.^3)* sqrt(-2+((3*r.^3)*(Bx/U)))-B
U is a constant
Bx and B are column matrix
I would have as a result a value of r for each value of Bx and B
is it possible to do this without the Symbolic math toolbox ?
Thank you

채택된 답변

Chris C
Chris C 2014년 3월 19일
You can run this with two functions. The first function I have designated as myMain.m and it is written as..
r0 = rand(3,3);
fsolve(@myfun,r0)
The second function myfun.m is called by the first function by passing initial guesses of r as r0. I altered the way your equation above was written and wrote the function as...
function F = myfun(r)
Bx = rand(3,1);
B = rand(3,1);
U = rand(1);
F = (U)*sqrt(-2+((3*r.^3)*(Bx/U)))-r.^3*B;
end
Change the matrices to whatever numbers you need and it should work.
Good luck.

추가 답변 (2개)

Benoit
Benoit 2014년 3월 20일
Hello,
Thank you for reactivity, I've tried you're solution. Im new to fsolve function so maybe I am missing something but your answer gives me just one solution.

Benoit
Benoit 2014년 3월 20일
Ok , i've got it.
Thank you

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by