I need help with a code for a crank slider system with newtons Rhapson method.

3 visualizaciones (últimos 30 días)
Hi, i need to make a code in matlab of a crank slider system with the Newtons Rhapson. This is my code right now but because is a crank slider system D. how do i found D?
% Crank-slider solucionado por el metodo de Newton Rhapson
clc;
clear;
%links
a=1.4;
b=4;
c=1;
%Angulos
th2=45;
th1=0;
th4=90;
%Primer valor de 'd' y 'theta3' para que entre al loop for end
d=3;
th3=178;
error=0.001;
for i=1:100
f1=a*cosd(th2)-d*cosd(th1)-b*cosd(th3)-c*cosd(th4);
f2=a*sind(th2)-d*sind(th1)-b*sind(th3)-c*sind(th4);
df1_th3=b*sind(th3);df1_d=d*sind(th1);
df2_th3=-b*cosd(th3);df2_d=-d*cosd(th1);
A=[df1_th3,df1_d;df2_th3,df2_d];
x=inv(A)*-[f1;f2];
if abs(sum(x))<=error
iteration=i;
break
end
th3=th3+x(1);
d=d+x(2);
end
iteration=i;
disp(th3)
disp(d)

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by