Effacer les filtres
Effacer les filtres

An error (Two different outputs for a single command)

2 vues (au cours des 30 derniers jours)
onsagerian
onsagerian le 9 Juil 2018
Commenté : onsagerian le 10 Juil 2018
Hello,
When I ran my simple program, there were two different outputs. (Only single value of "gamma" in this case are expected one but I had two values. I have no idea on this part. Would you answer me?
(I am attaching a part of my program)
format long e
C_0=0.1;
T=0.1;
k=2.0; %default value is 2.0
k_1=1.0; %k(-1) default value is 0.1 (modified: 1.0)
k_2=0.01; %k(-1*)
k_(1)=10; %k'(-1) default value is 10
k_(2)=1.0; %k'(-1*) default value is 1.0
a_p=0.0008; %k(p) default value is 0.0002
k_p=0.00001; %k(-p)
%theta=k_1/k_(1);
theta=k_2/k_(2);
m=0.0000005;
W=0.002;
gamma=(a_p*k*k_2)./(k_p*m*k_)

Réponse acceptée

per isakson
per isakson le 9 Juil 2018
Modifié(e) : per isakson le 9 Juil 2018
k_ is a row vector, which explains why gamma becomes a row vector
>> whos k_ gamma
Name Size Bytes Class Attributes
gamma 1x2 16 double
k_ 1x2 16 double
gamma is the name of a built-in function and thus should not be used as the name of a variable.
  1 commentaire
onsagerian
onsagerian le 10 Juil 2018
Thank you for your explanation. Actually, I realized I put a wrong format(k_). Anyway, I've learned how to assign a name of variable under certain conditions.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Gamma Functions dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by