Undefined funcion variable error

1 回表示 (過去 30 日間)
STP
STP 2019 年 1 月 22 日
回答済み: Image Analyst 2019 年 2 月 3 日
% Constants
beta=5;
alfa = 2.*beta/(beta+1);
tau1=4.4;
tau2=5;
Tc=1.24;
Ta=0.66;
g=0;
gamma=alfa.*(2-exp(-tau1));
% Time frames
t1=0:0.01:tau1;
t11 = tau1:0.01:8;
t2 = tau1:0.01:tau2;
t22 = tau2:0.01:8;
t3 = tau2:0.01:8;
t'==t1./Ta
z'=1
Va=@(t)alfa.*exp(-(u.*t')).*(1-g.*z') - (alfa-1);
Va1=Va(t1);
plot(t1,Va1);
Undefined function or variable 't'.
  1 件のコメント
Jan
Jan 2019 年 1 月 22 日
These lines are not correct:
t'==t1./Ta
z'=1
The second mus stop Matlab with an error. Therefore I cannot believe, that the definition of Va is reached to produce this error message. Please post the real code.

サインインしてコメントする。

採用された回答

madhan ravi
madhan ravi 2019 年 1 月 22 日
編集済み: madhan ravi 2019 年 1 月 22 日
t=t1./Ta % you define t here
z=1
Va=@(t)alfa.*exp(-(u.*t)).*(1-g.*z) - (alfa-1); % also you have a @(t)?? you have some problem with naming variables
Va1=Va(t1);
plot(t1,Va1);
Notes:
  • ' in matlab denotes complex conjugate transpose
  • to assign a variable to a numerical number/s use "=" not "=="
  • u is not defined in your code
  • I strongly suggest you to read anonymous function (usage)
  • Also don't name the variable gamma it contradicts with matlab's in-built function gamma

その他の回答 (1 件)

Image Analyst
Image Analyst 2019 年 2 月 3 日
You're doing a comparison
t'==t1./Ta
without sending the result to any variable. So it tries to get the variable "t" and take the transpose of it (because you used the apostrophe operator) so that it can compare it for equality to t1./Ta. The problem is t does not yet exist.
When you wrote that, what did you think t was supposed to be?

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by