Invalid Expression with plotting t
1 view (last 30 days)
Show older comments
James Brocklehurst
on 9 Apr 2021
Edited: the cyclist
on 9 Apr 2021
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?
0 Comments
Accepted Answer
the cyclist
on 9 Apr 2021
Edited: the cyclist
on 9 Apr 2021
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 Comments
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!