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.

 Akzeptierte Antwort

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

2 Kommentare

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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 9 Okt. 2011
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 Kommentar

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.

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by