Linspace is changing my function values

7 ビュー (過去 30 日間)
Taylor Shead
Taylor Shead 2019 年 4 月 28 日
編集済み: Stephen23 2019 年 4 月 29 日
Hello,
Maybe I do not understand fully what linspace does but when I change my from:
t = linspace(0,250)
to
t = linspace(0,1000)
my output values change. One of my functions (with the most noticeable trend) is:
Pe_po = eta*R_po*m_po*1000*.5.^(t/HL_po);
which is a plot of the electrical power decay in thermoelectric generator using a Polonium-210 radioisotope source. The output increases about 4 fold while the other graphs seem to remain the same but that may be due to their longer half-life.
What I am trying to do is increase the x-axis plotting but this is what I get instead:
t = linspace(0,250)
Capturep1.PNG
t = linspace(0,1000)
Capturep1000.PNG
I am using the Student Version and have some limited Matlab experience (probably less than I should).
Am I using linspace worng or do I need an entirely differen function to graph with?
  1 件のコメント
Stephen23
Stephen23 2019 年 4 月 29 日
編集済み: Stephen23 2019 年 4 月 29 日
@Taylor Shead: please edit your question and show us your plot command.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2019 年 4 月 28 日
The linspace function by default produces a vector of 100 elements, so it increments the elements proportionately.
The element intervals are:
ElInt = (maxv - minv)/(len-1)
where ‘maxv’ is the maximum value desired, ‘minv’ is the minimum (starting) value, and ‘len’ is the number of elements, in:
v = linspace(minv, maxv, len);
If you want the same element spacing in your longer vector, this works:
t = linspace(0,1000, 397);
Experiment to get the result you want.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by