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

 채택된 답변

James Tursa
James Tursa 2019년 9월 21일
편집: James Tursa 2019년 9월 21일

0 개 추천

You could use V(2:end) or V(1:end-1) instead of V in that line. Or maybe average the two.

댓글 수: 5

Jose Cruz
Jose Cruz 2019년 9월 21일
Thank you, this works! I realized with your anwer that I should use V(1:end-1) throught all my equations.
Walter Roberson
Walter Roberson 2019년 9월 21일
gradient()
Jose Cruz
Jose Cruz 2019년 9월 21일
Is gradient meant to be used with funtions or will it work with numerical (emperical) values loaded from .mat?
Walter Roberson
Walter Roberson 2019년 9월 21일
There are two versions of gradient(). One of them works with symbolic functions or symbolic expressions; the other works with numeric matrices.
Jose Cruz
Jose Cruz 2019년 9월 21일
Thank you! I'll have to try with the gradient and see how it compares to using V(1:end-1).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Polynomials에 대해 자세히 알아보기

질문:

2019년 9월 21일

댓글:

2019년 9월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by