my code is below. I am trying to vary the constants r and K in the equation for M_spring. Then I want to plot M_spring vs R and M_spring vs K. i keep getting the error that matrix are not same dimensions. can someone assist me?? Thank you
%Input Given Parameters
%Lengths
l1=0.006; l2=0.02; l3=0.015; l4=0.02; l5=0.015; wing = 0.033; l = [l1 l2 l3 l4 l5]; L = .04; %Masses
m1=0.00025; m2=0.0005; m3=0.00025; m4=0.0025; mass = [m1 m2 m3 m4]; %Pivots
d1x=0.015; d1y=0.021; d2x=-0.015; d2y=0.021; d = [d1x d1y d2x d2y]; %Inputs
th1dot=10; th1=90 r =[0.05:.01:.2]; k = [0:5:500];A_r = -2*d(1)*l(3) + 2*l(1)*l(3).*cos(th1);B_r = -2*d(2)*l(3) + 2*l(1)*l(3).*sin(th1);C_r = d(1)^2+d(2)^2+l(1)^2+l(3)^2-l(2)^2-... 2*l(1).*(d(2).*sin(th1)+d(1).*cos(th1));th3 = 2*atan2(-B_r-sqrt(B_r.^2-C_r.^2+A_r.^2),C_r-A_r);M_spring = ((d1x + r*sin(th3))/(d1y +r*cos(th3)))*k*L + m1*l1*cos(th1)*th1dotplot(r,M_spring)stay onplot(k,M_spring)
Best Answer