code wont match dimensions

1 Ansicht (letzte 30 Tage)
Boss Man
Boss Man am 24 Dez. 2019
Kommentiert: Boss Man am 24 Dez. 2019
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

Akzeptierte Antwort

David Hill
David Hill am 24 Dez. 2019
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.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB 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