How do I plot outside temperature versus time in Matlab?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I'm not sure how to graph the following code in Matlab (Temperaure over 24 hour period should look sinusodal):
for t = 1:24
T(t,1) = (((Tmax - Tmin)/2)+((Tmax - Tmin)/2) * sin(((t - 9)/12)*Pi));
Thank you!
6 件のコメント
rough93
2019 年 9 月 25 日
Gotcha! See my answer below. If you want to start from midnight instead of mid day, change the +3 to -9.
回答 (2 件)
Kevin Phung
2019 年 9 月 25 日
編集済み: Kevin Phung
2019 年 9 月 25 日
no for loop needed.
Tmax = 310;
Tmin = 298;
t=(1:24)'; % transposed if you want a column vs row
T = ((Tmax - Tmin)/2) + ((Tmax-Tmin)/2)*sin((t-9)/12*pi)
figure
plot(T)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!