linspace returning 1 value

조회 수: 7 (최근 30일)
Christopher Redard
Christopher Redard 2021년 11월 24일
댓글: Image Analyst 2021년 11월 24일
Tmax = 1000;
Tc = linspace(487.87,Tmax)
when running the script, Tc is set to just the Tmax value but should be returning 100 evenly spaced values.

답변 (1개)

Image Analyst
Image Analyst 2021년 11월 24일
You need to give linspace() the number of points, like
Tmin = 487.87;
Tmax = 1000;
numPoints = 100;
Tc = linspace(Tmin, Tmax, numPoints)
  댓글 수: 4
Christopher Redard
Christopher Redard 2021년 11월 24일
I don't know. I copy and pasted the code into a new script and it worked now. Thanks for the help.
Image Analyst
Image Analyst 2021년 11월 24일
Maybe you forgot to click the run button. If you do, it will run identically each and every time. I've be extremely surprised if that same code ran one way in your old script and another way in your new script, my computer, and in MATLAB online.
So, since it's solved, can you click the "Accept this answer" link? Thanks in advance.

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

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by