Need help storing and using values from an array
Show older comments
I'm trying to learn how to store values in an array. I was trying to create a list of 200 values for Tin which is the temperature using the last value of Tin for the next as well. t is the time ranging from 1:200. I coudn't find any relevant sources online :( Thanks for any help. If there are any questions I would happily explain the parts of my code. (Sorry for reupload -- I wasn't getting any useful help). I haven't used arrays before and the ones on the internet weren't any help, so go easy on me.
clear
t=zeros(200,1); %unsure
h= 1.6;
w=1.2;
l=1.8;
a=40;
Tin = 5;
Tout=5;
Theater=40;
M=0.25;
dt=1;
heaterState = 1;
Tlower = 21;
Tupper = 24;
dT=0;
c=1005.4;
for t1=1:200 % t is the time and
Tin = Tin+dT;
if Tin>Tupper
heaterState =0;
elseif Tin< Tlower
heaterState =1;
end
[Qloss,m] = getQloss(Tin,Tout,dt,h,w,l,a);
if heaterState ==1
[Qheat] = getQheater(Tin,Theater,M,dt);
else
Qheat = 0;
end
dT = (Qheat - Qloss)*(1/(m*c));
t(t1)=norm( %unsure
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!