How to get Matlab to calculate answers from linspace

5 ビュー (過去 30 日間)
Luke
Luke 2018 年 4 月 1 日
回答済み: Walter Roberson 2018 年 4 月 1 日
Hi, I want to calculate the temp change from years 1 to 5; however I keep getting nothing when I run the code. Would appreciate any help.
T0 = 473.15; %initial temp
r = 10; %cooling in C per year
t = linspace(0,5,1); %trying to find temp change from years 1-5 for each year
T = T0-r.*t; %equation

採用された回答

Walter Roberson
Walter Roberson 2018 年 4 月 1 日
You have
linspace(0,5,1)
linspace(A, B, C) requests that you take a total of C point starting from A and ending at B (inclusive in both cases.) So you are asking for there to be only 1 point.
If you want integer year numbers use 1:5

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by