我是Matlab的初学者,想要绘制系统浓度与时间之间的曲线,在特定的时间间隔内。以下是我编写的代码:
我遇到了以下错误:
"||" 和 "&&" 运算符的操作数必须可以转换为逻辑标量值。
%输入函数包括9个样本的活性和时间,校准后的值为1.856,来自3名患者的所有9个输入值。
function c_o = Sample_function(td,t_max,A,B)
t =(0 : 100 :5000); % time of the sample post injection in mins
c =(0 : 2275.3 :113765);
A_max= max(c); %Max value of Concentration (Peak of the curve)
if (t >=0 && t <= td)
c_o(t)=0;
else if(td <=t && t<=t_max)
c_o(t)= A_max*(t-td);
else if(t >= t_max)
c_o(t)=(A(1)*exp(-B(1)*(t-t_max)))+(A(2)*exp(-B(2)*(t- t_max)))+...
(A(3)*exp(-B(3)*(t-t_max)));
end
fprintf('plotting Data ...\n');
hold on;
figure;
plot(c_o);
xlabel('Activity of the sample Ba/ml ');
ylabel('time of the sample in minutes');
title (' Input function: Activity sample VS time ');
pause;
end
我遇到了以下错误:
"||" 和 "&&" 运算符的操作数必须可以转换为逻辑标量值。
Error in Sample_function (line 18)
if (t >=0 && t <= td)
请告知我是否我的逻辑有误