An error (Two different outputs for a single command)

조회 수: 1 (최근 30일)
onsagerian
onsagerian 2018년 7월 9일
댓글: onsagerian 2018년 7월 10일
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