help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 
% function accepts as input arguments LoadWeight and LoadPosition.
% 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 
% function accepts as input arguments LoadWeight and LoadPosition.
% 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

function [Decision, InclinationAngle] = Student809243(LoadWeight, LoadPosition)
    AssemblyData = csvread('AssemblyParameters.csv'); % This reads the AssemblyParameters
    %dlmread('AssemblyParameters.csv')
    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);
    W = [(LoadWeight);(-1*LoadWeight*LoadPosition)];
    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);
    
    LoadWeightNormal = LoadWeight*cos(theta);
LoadWeightTang = LoadWeight*sin(theta);

fL = (kl*D(1,1));
fR = (kr*D(2,1));
if LoadPosition > M(1,5)  
   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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]