Solve nonlinear equations with fsolve

1 visualización (últimos 30 días)
Emidio Bacco
Emidio Bacco el 20 de Nov. de 2017
Editada: Emidio Bacco el 20 de Nov. de 2017
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

Respuestas (0)

Categorías

Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by