Solve nonlinear equations with fsolve

조회 수: 1 (최근 30일)
Emidio Bacco
Emidio Bacco 2017년 11월 20일
편집: Emidio Bacco 2017년 11월 20일
I have this code :
main.m
syms t1 t2
a=5;
b=10;
x0=5;
y0=10;
x0_1=30;
y0_1=10;
raggio=3;
x1=x0+a*cos(t1)
y1=y0+b*sin(t1)
x2= x0_1+raggio*cos(t2)
y2= y0_1+raggio*sin(t2)
m_1=diff(y1)/diff(x1)
m_2=diff(y2)/diff(x2)
m_3=y2-y1/x2-x1
fun = @root2d;
t0 = [pi/2,pi/2];
t = fsolve(fun,t0)
% I have to solve a system of nonlinear equations with fsolve , but I don't know how to pass the expression m_1,m_2,m_3. The system of equations is
% m_1-m_3=0
% m_2-m_3=0
%and I have to solve this system to find the value of t1 and t2. But I don't know how can I do this.
%I create another file.m call root2d.m
function F = root2d(t)
t1=t(1)
t2=t(2)
F(1) = m_1 - m_3;
F(2) = m_2 - m_3;
end
Please help me
Thanks

답변 (0개)

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by