Invalid Expression with plotting t

1 visualización (últimos 30 días)
James Brocklehurst
James Brocklehurst el 9 de Abr. de 2021
Editada: the cyclist el 9 de Abr. de 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?

Respuesta aceptada

the cyclist
the cyclist el 9 de Abr. de 2021
Editada: the cyclist el 9 de Abr. de 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()

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by