gpt4 book ai didi

matlab - 绘制 Matlab 函数的问题

转载 作者:太空宇宙 更新时间:2023-11-03 20:00:02 26 4
gpt4 key购买 nike

我是 Matlab 的初学者,我想在一定的时间间隔内绘制系统浓度与时间的关系图,以下是我编写的代码

%9 个 sample 的输入函数, active 和时间用 Well 校准%counter value approx: 1.856 from all 9 input values of 3 patients

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)

请。如果我的逻辑不正确,请告诉我

最佳答案

您的 t 不是要与 0 进行比较的单个值,因此它无法评估为 true 或 false。

关于matlab - 绘制 Matlab 函数的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21786003/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com