defining and plotting a function in MATLAB

1 回表示 (過去 30 日間)
Kristyna Herman
Kristyna Herman 2021 年 1 月 28 日
コメント済み: Kristyna Herman 2021 年 1 月 28 日
Hello,
I am trying to plot this function:
p = @(theta) p0_CSF*sin(theta)*((1-exp(TR/T1_CSF))/(1-exp(TR/T1_CSF))*(TE/T2_CSF) (where I have defined all variables above it)
plot(theta,p)
and I get this error:
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Could you please explain the error and how to fix it?
Thank you!

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 1 月 28 日
Your missing a closing parenthesis!
p = @(theta) p0_CSF*sin(theta)*((1-exp(TR/T1_CSF)))/(1-exp(TR/T1_CSF))*(TE/T2_CSF)
% I guessed it should be there:^
plot(theta,p(theta))
HTH

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by