help-octave
[Top][All Lists]

## warning: implicit conversion from numeric to char

 From: Daniel Rabinovitch Subject: warning: implicit conversion from numeric to char Date: Sun, 18 Nov 2018 12:37:18 +0200

% A function to determine whether a load placed on a plane which
% is supported by a pair of springs will slide or not. The
% The function outputs a Decision. {     }
% A function to determine whether a load placed on a plane which
% is supported by a pair of springs wileftTol slide or not. The
% The function outputs a Decision. {     }
% The function reads an external data file which specifies the
% assembly parameters. i.e. Spring constants and spring positions.
% Function caleftTol is as foleftTolows: Out1 = Slide(Arg1,Arg2)

% Student number 809243

M=AssemblyData;
kl=M(1,1);
kr=M(1,2);
xl=M(1,3);
xr=M(1,4);
xm=M(1,5);
leftTol=M(1,6);
rightTol=M(1,7);
mu=M(1,8);
N = [kl,kr;(kl*xl),(kr*(xm+xl))];
%  inverse(N)
D = inverse(N)*W; %[delta Y_l; deltaY_r]
theta = atan((D(2,1)-D(1,1))/xm);
InclinationAngle=theta;
a = mu*cos(theta);
b = sin(theta);

fL = (kl*D(1,1));
fR = (kr*D(2,1));
disp('0')
end
Decision = [];

%accordig to maths provided if mu*costhetha < sintheta then object will slide
%if mu*costhetha > sintheta then object will stay

%slide
if (mu*cos(theta)<sin(theta) && (fL<leftTol) && (fR < rightTol))
Decision = num2str([Decision, sprintf('-1 ')])
elseif (mu*cos(theta)<(sin(theta)) && (fL>leftTol) && (fR < rightTol))
Decision = num2str([Decision, sprintf('-1 '), sprintf(' 0.5L')])
elseif (mu*cos(theta)<(sin(theta)) && (fL<leftTol) && (fR > rightTol))
Decision = num2str([Decision ,sprintf('-1 '), sprintf(' 0.5R')])
elseif (mu*cos(theta)<(sin(theta)) && (fL>leftTol) && (fR > rightTol))
Decision = num2str([Decision, sprintf('0.5 ') , sprintf('-1')])

%stay
elseif (mu*cos(theta)>sin(theta)&& (fL<leftTol) && (fR < rightTol))
Decision = num2str([Decision, sprintf('1')])
elseif (mu*cos(theta)>sin(theta)&& (fL>leftTol) && (fR < rightTol))
Decision = num2str([Decision, sprintf('1'),   sprintf(' 0.5L')])
elseif (mu*cos(theta)>sin(theta)&& (fL<leftTol) && (fR > rightTol))
Decision = num2str([Decision, sprintf('1 '), sprintf(' 0.5R')])
elseif (mu*cos(theta)>sin(theta)&& (fL>leftTol) && (fR > rightTol))
Decision = num2str([Decision, sprintf('0.5 ') , sprintf('1')])
endif

end