Inputting a certain number of data points between two values

I need to input x values from 0 to pi with ten data points in that range. How do I specify that I want ten data points? I know how to say:
x = [0:0.5:pi]
to give me values that are 0.5 apart from 0 to pi, and I could keep changing that number in the middle until I have ten values, but is there a way to just make it give me ten evenly spaced data points? Thank you!

 채택된 답변

Star Strider
Star Strider 2019년 3월 20일
x = linspace(0, pi, 10);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2019년 3월 20일

댓글:

2019년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by