An error (Two different outputs for a single command)

2 次查看(过去 30 天)
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_)

采纳的回答

per isakson
per isakson 2018-7-9
编辑:per isakson 2018-7-9
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 个评论
onsagerian
onsagerian 2018-7-10
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Gamma Functions 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by