How to get Matlab to calculate answers from linspace

5 Ansichten (letzte 30 Tage)
Luke
Luke am 1 Apr. 2018
Beantwortet: Walter Roberson am 1 Apr. 2018
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 1 Apr. 2018
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

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by