Invalid Expression with plotting t
조회 수: 1 (최근 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?
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!