matlab函数编写和数据拟合

问题遇到的现象和发生背景

img

问题相关代码,请勿粘贴截图

运行结果及报错内容
我的解答思路和尝试过的方法

我想请哪位朋友帮助解决函数的编写,完成数据拟合

我想要达到的结果
function c_o = Sample_function(td,t_max,a1,a2,a3,b1,b2,b3)
   t =(0: 100 :5000); 
   c =(0 : 2275.3 :113765);
   A_max= max(c);

   c_o = zeros(size(t));
   c_o(t>td & t<=t_max) = A_max*(t(t>td & t<=t_max)-td);

   c_o(t>t_max)=(a1*exp(-b1*(t(t>t_max)-t_max)))+(a2*exp(-b2*(t(t>t_max)-t_max)))+(a3*exp(-b3*(t(t>t_max)-t_max)));        

   fprintf('plotting Data ...\n');
   hold on;
   %figure ;
   plot(c_o,'erasemode','background');
   xlabel('样本时间(分钟) ');
   ylabel('样品活性Ba/ml');
   title (' 输入函数:活动示例VS时间');

   pause;
end

matlab中有专门的工具箱可以进行数据拟合,输入数据和公式就行。

你这个函数的变量是哪些,常量是哪些?