Invalid Expression with plotting t

1 回表示 (過去 30 日間)
James Brocklehurst
James Brocklehurst 2021 年 4 月 9 日
編集済み: the cyclist 2021 年 4 月 9 日
dt=0.01;
h=0.1;
w=0.1;
to=2.5;
t=0:dt:10;
r=h*exp(-((t-to).^2)/w^2);
plot=(t,r,'b','linewidth',2);
xlabel('t')
ylable('r(t)')
grid on
I am gettin an error with this code for the plot. Is there a reason why t is giving me an issue? The error is:
Error: File: EET433Lab2.m Line: 98 Column: 8
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
This is for "t" in the plot line? What did I do wrong?

採用された回答

the cyclist
the cyclist 2021 年 4 月 9 日
編集済み: the cyclist 2021 年 4 月 9 日
Your code works after I fix two typos:
dt=0.01;
h=0.1;
w=0.1;
to=2.5;
t=0:dt:10;
r=h*exp(-((t-to).^2)/w^2);
plot(t,r,'b','linewidth',2);
xlabel('t')
ylabel('r(t)')
grid on
You had
plot=()
and
ylable()

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by