[英]How do I fix the following error in if-else statement in MATLAB
所以我有以下代码:
if tau_a == tau_b
ana_nb = NB * exp(-t/tau_a) + t * (NA/tau_a) * exp(-(t/tau_a))
else
ana_nb = NB * exp(-t/tau_b) + NA/((tau_a/tau_b)-1) * (exp(-t/tau_a) - exp(-t/tau_b))
end
在这里NA = 100,NB = 80,tau_a = 2,tau_b = 4,t是一个数字数组(大小为21)
我收到的错误消息是: “使用*时出错。内部矩阵尺寸必须一致。”
我该如何解决?
您将不得不使用元素明智的乘法.*
ana_nb = NB .* exp(-t/tau_a) + t .* (NA/tau_a) .* exp(-(t/tau_a))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.