Filter löschen
Filter löschen

An error (Two different outputs for a single command)

2 Ansichten (letzte 30 Tage)
onsagerian
onsagerian am 9 Jul. 2018
Kommentiert: onsagerian am 10 Jul. 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_)

Akzeptierte Antwort

per isakson
per isakson am 9 Jul. 2018
Bearbeitet: per isakson am 9 Jul. 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 Kommentar
onsagerian
onsagerian am 10 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Gamma Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by