jquery - Creating code representing the Position Analysis of a Slider Crank Mechanism using a Newton Raphson Method. -
jquery - Creating code representing the Position Analysis of a Slider Crank Mechanism using a Newton Raphson Method. -
i trying create position analysis code of slider crank mechanism in matlab.
i maintain getting next error in code , cant understand how prepare it. give me guidance.
undefined function 'solve' input arguments of type 'char'.
error in slidercrank (line 20) solc = solve(eqnc, 'xcsol' );
the code below
% position analysis % r-rrt clear % clears variables workspace clc % clears command window , homes cursor close % closes open figure windows % input info ab=0.5; bc=1; phi = pi/4; % position of joint (origin) xa = 0; ya = 0; % position of joint b - position of driver link xb = ab*cos(phi); yb = ab*sin(phi); % position of joint c yc = 0; % distance formula: bc=constant eqnc = '( xb - xcsol )ˆ2 + ( yb - yc )ˆ2 = bcˆ2'; % solve above equation solc = solve(eqnc, 'xcsol' ); % solve symbolic solution of algebraic equations % 2 solutions xc - vector form % first component of vector solc xc1=eval(solc(1)); % sec component of vector solc xc2=eval(solc(2)); % eval executes string look or statement % select right position c % given input angle if xc1 > xb xc = xc1; else xc = xc2; end % if conditionally executes statements % angle of link 2 horizontal phi2 = atan((yb-yc)/(xb-xc)); fprintf('results \n\n') % print coordinates of b fprintf('xb = %g (m)\n', xb) fprintf('yb = %g (m)\n', yb) % print coordinates of c fprintf('xc = %g (m)\n', xc) fprintf('yc = %g (m)\n', yc) % print angle phi2 fprintf('phi2 = %g (degrees) \n', phi2*180/pi) % graphic of mechanism plot([xa,xb],[ya,yb],'r-o',... [xb,xc],[yb,yc],'b-o'),... xlabel('x (m)'),... ylabel('y (m)'),... title('positions \phi = 45 (deg)'),... text(xa,ya,' a'),... text(xb,yb,' b'),... text(xc,yc,' c'),... axis([-0.2 1.4 -0.2 1.4]),... grid % commas , ellipses (...) after commands % used execute commands % end of programme
the first thing appears on solve
documentation page is:
solve
not take string inputs containing multiple input arguments. in future releases, string inputs deprecated. in place of string inputs, first declare variables using syms
, pass them comma-separated list or vector.
so need have:
syms xcsol eqnc = ( xb - xcsol )ˆ2 + ( yb - yc )ˆ2 == bcˆ2; % no single quotes, not string, need == % solve above equation solc = solve(eqnc, xcsol ); % no single quotes here either
jquery matlab computer-science
Comments
Post a Comment