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

2 views (last 30 days)
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.

Accepted Answer

Dr. Seis
Dr. Seis on 9 Oct 2011
You can create a dx, such as:
dx = pi/100;
Then define x as:
x = -pi/2 : dx : pi/2-dx;
  2 Comments
Annabelle
Annabelle on 9 Oct 2011
That's great, so I just needed to use smaller intervals by creating a preceding variable, many thanks.
Dr. Seis
Dr. Seis on 9 Oct 2011
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.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 9 Oct 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 Comment
Annabelle
Annabelle on 9 Oct 2011
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.

Sign in to comment.

Categories

Find more on Simulink in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!