array

조회 수: 3 (최근 30일)
Kugen Raj
Kugen Raj 2012년 3월 22일
i want to list down data r=0.1:0.5. but, im not getting the answer. briefly, i need to create an array with data that starts from 0.1 and ends with 0.5. but, using the code (r=0.1:0,5), im not getting a desired answer rather than 0.1 all the time. thomas anthony's explanation clarifies me what does this code actually do. now, i understand how to define it correctly to get a desired answer.
  댓글 수: 1
Jan
Jan 2012년 3월 23일
Please use meaningful tags. All questions in this forum concern "matlab code".
It is not clear, what you are trying to do. What is "list down data" and what is "r"? What answer do you expect?
It is better to post the code and explain what happens and the difference to your expectations.

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

채택된 답변

Jan
Jan 2012년 3월 23일
What do you want r to be? Perhaps you are looking for:
r = linspace(0.1, 0.5, 10)
See:
help linspace

추가 답변 (1개)

Thomas
Thomas 2012년 3월 22일
You are tying to list data in an array starting form 0.1 to 0.5 with a difference of 1 and so it will show only the first data point..
Try:
differ=0.1; % difference of 0.1 change this value for finer control
r=0.1:differ:0.5

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by