Borrar filtros
Borrar filtros

Hi, I am facing difficulty in plotting these functions.

3 visualizaciones (últimos 30 días)
priya
priya el 20 de Jul. de 2019
Comentada: Star Strider el 20 de Jul. de 2019
How can i compare a string a =[0: 0.05: 10] with a constant value, say 5. I want the string to be compared with that constant, and for values of a greater than 5, i want to plot another function.
a =[0: 0.05: 10];
if a > 5
y = sin(2*pi*a);
else
y=0;
but this is not working.

Respuesta aceptada

Star Strider
Star Strider el 20 de Jul. de 2019
Try this:
a = 0 : 0.05 : 10;
y = sin(2*pi*a.*(a>5));
figure
plot(a, y)
grid
Experiment to get the result you want.
  2 comentarios
priya
priya el 20 de Jul. de 2019
thank you so much, it is working.
Star Strider
Star Strider el 20 de Jul. de 2019
My pleasure.
If my Answer helped you solve your problem, please Accept it!

Iniciar sesión para comentar.

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