code wont match dimensions

1 回表示 (過去 30 日間)
Boss Man
Boss Man 2019 年 12 月 24 日
コメント済み: Boss Man 2019 年 12 月 24 日
a=[00.00 22.3
00.06 22.4
00.11 22.4
00.16 22.5
00.21 22.4
00.26 22.4
00.31 22.3
00.36 22.2
00.41 22.2
00.46 22.1
00.51 22
00.56 21.9];
b=[00.00 3.8
00.05 3.8
00.10 3.8
00.15 3.7
00.20 3.6
00.25 3.6
00.31 3.5
00.36 3.5
00.41 3.4
00.45 3.4
00.50 3.3
00.55 3.3];
%matrix a of indoor temp
%matrix b of outdoor temp
dt=diff(a)/5;
c=dt./(b(1:end-1)-a(1:end-1));%diff(a) will be one less than matrix a and b
plot(c);
I want to display the left hand side of the matrix on the x-axis, don't want it involved in the calculations of c and dt. how would i do that?
thanks for any help given

採用された回答

David Hill
David Hill 2019 年 12 月 24 日
dt=diff(a(:,2))/5;
c=dt./(b(2:end,2)-a(2:end,2));%diff(a) will be one less than matrix a and b
plot(a(2:end,1),c);
This should work for you.
  1 件のコメント
Boss Man
Boss Man 2019 年 12 月 24 日
thank u so much

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by