close all
clear all

M0=0;
M1=249;
M2=454;
M3=720; % ?
M4=666;
Mb=2113;

mass=[M0;
      M2;
      M2+M3;
      M2+M3+M4;
      M2+M3+M4+M1;
      M2+Mb;
      M2+Mb+M3;
      M2+Mb+M3+M4];

resB=[29; 29; 39; 86; 101; 140; 194; 223];
regB=robustfit(mass,resB);

resG=[29; 29; 29; 79; 100; 138; 195; 223];
regG=robustfit(mass,resG);

resO=[29; 35; 63; 91; 100; 127; 180; 224];
regO=robustfit(mass,resO);

resW=[28, 30, 61, 98, 109, 137, 190, 224];
regW=robustfit(mass,resW);

figure('name','Sensor Azul')
axes('fontsize',14);
plot(mass,resB,'s',mass,regB(1)+regB(2)*mass,'linewidth',2);
xlabel('mass');
ylabel('Sensor output');

figure('name','Sensor Verde')
axes('fontsize',14);
plot(mass,resG,'s',mass,regG(1)+regG(2)*mass,'linewidth',2);
xlabel('mass');
ylabel('Sensor output');

figure('name','Sensor Castanho')
axes('fontsize',14);
plot(mass,resO,'o','linewidth',2);
xlabel('mass');
ylabel('Sensor output');

figure('name','Sensor Branco')
axes('fontsize',14);
plot(mass,resW,'o','linewidth',2);
xlabel('mass');
ylabel('Sensor output');
