Error: Matrix dimensions must agree
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jose Cruz
am 21 Sep. 2019
Kommentiert: Jose Cruz
am 21 Sep. 2019
I need to multiply the Diff () = dVdt [1369 x 1] with V [1370 x 1] equation. How can I add to the lenght of dVdt? I need to add three terms together and their Matrix Dimeions must match. See error below:
Matrix dimensions must agree.
Error in homework_1_P2 (line 40)
Inertia = (1.1*Mv*(dVdt).*V)./1000; % kW
load CYC_FUDS.mat
t = cyc_mph(:,1); % Time [s]
Vmph = cyc_mph(:,2); % Velocity [mph]
V = Vmph.*(1609/3600); % Velocity [m/s]
dVdt = (diff(V)./diff(t)); % Accel. m/s^2
% Aerodynamic = (0.5*pa*Cd*Af*V.^3)./1000; % kW
% Rolling = ((Cr*Mv*g*cos(Xa)).*V)./1000; % kW
Inertia = (1.1*Mv*(dVdt).*V)./1000; % kW
% Pw = (Aerodynamic+Rolling+Inertia); % kW
0 Kommentare
Akzeptierte Antwort
James Tursa
am 21 Sep. 2019
Bearbeitet: James Tursa
am 21 Sep. 2019
You could use V(2:end) or V(1:end-1) instead of V in that line. Or maybe average the two.
5 Kommentare
Walter Roberson
am 21 Sep. 2019
There are two versions of gradient(). One of them works with symbolic functions or symbolic expressions; the other works with numeric matrices.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sparse 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!