Invalid Expression with plotting t

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by