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.

 채택된 답변

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

댓글 수: 2

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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 10월 9일

0 개 추천

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

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.

댓글을 달려면 로그인하십시오.

카테고리

태그

질문:

2011년 10월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by