trying to create a variable less than or equal to pi/2 but more than -pi/2

Hey, I'm sure I must be missing something completely obvious, but I have been trying to create the variable x which is a certain range, -pi/2 >= x pi/2 I've tried things such as x = (= -1.5708) & (<= 1.5708) x = -1.5708:0.1:1.5708 Not sure how to best approach this. Many thanks.

 Respuesta aceptada

You can create a dx, such as:
dx = pi/100;
Then define x as:
x = -pi/2 : dx : pi/2-dx;

2 comentarios

That's great, so I just needed to use smaller intervals by creating a preceding variable, many thanks.
It isn't necessary to create the "dx" variable. It is equally valid to also do:
x = -pi/2 : pi/100 : pi/2 - pi/100;
I like to create the "dx" variable because if I want to make it smaller or larger, then I need only change it once.

Iniciar sesión para comentar.

Más respuestas (1)

You asked about this before and did not respond to requests for clarification. Please delete this question and go back to your previous question and clarify there.

1 comentario

really sorry about that, I started writing the previous one but didn't finish it because I had to rush to a lecture and simply closed the window, I didn't realise that it still published itself.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Oct. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by