clear all
close all
clc
% PHUA: force rendering __________________________________________
COP_0 = 0;
COP_dz = 1;   % deadzone
A = -2.5; K = 2.5; Q = 0.5;
% Richard's curve: influence of the growth rate B ________________ 
B = 1;
COP = linspace(-8,8,101);
%COP = linspace(0,0,101);
F = zeros(length(B),length(COP));

ILog = (COP >= COP_0+COP_dz); % COP > COP0+COP_dz
v = 0.585; M = COP_0+COP_dz; 
F(:,ILog) =A+(K-A)./(1+Q*exp(-B*(COP(ILog)-M))).^(1/v);
%I = find(x >= COP_0+COP_dz); I(1), F5(I(1)) % Ajustar F(0)

ILog = (COP < COP_0-COP_dz);   % COP < COP0-COP_dz
v = 0.5895; M = COP_0-COP_dz; 
F(:,ILog) =A+(K-A)./(1+Q*exp(-B*(COP(ILog)-M))).^(1/v);
%I = find(x < COP_0-COP_dz); I(end), F5(I(end)) % ajustar F(0)


figure
plot(COP,F,'LineWidth',2)
xlabel('COP','FontSize',14), ylabel('Force','FontSize',14)
legend('B=1')