lundi 2 juillet 2018

How do I fix the following error in if-else statement in MATLAB

So I have the following code:

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

Here NA = 100, NB = 80, tau_a = 2, tau_b = 4, t is an array of numbers (with a size of 21)

The error message I get is: "Error using *. Inner matrix dimensions must agree."

How do I fix this?

Aucun commentaire:

Enregistrer un commentaire