Solve nonlinear equations with fsolve
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Systems of Nonlinear Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!