Can I multiply a two different size vectors?
Afficher commentaires plus anciens
I have been using vector indexing to plot derivatives as so: vel=diff(pos); plot(t(1:end-1),vel)
I need to multiply the first derivative vector by the second derivative vector but it wont allow me to use vector indexing. Is there an alternative way? Below is my equation. T=J*vel(1:end-1)*acl;
%Coefficients
p1 = 301.59;
p2 = -376.99;
p3 = 125.66;
p4 = 8.5359e-07;
p5 = -4.9784e-08;
p6 = 8.0277e-10;
J = .0537 %kgm^2;
%Equation
pos = p1*t.^5+p2*t.^4+p3*t.^3+p4*t.^2+p5*t+p6;
%%Position vs Time
f1=figure
plot(t,rad)
title('Postition Graph ')
xlabel('Time (s)')
ylabel('Position (rad)')
%%Velocity
f2=figure
vel=diff(pos);
plot(t(1:end-1),vel)
title('Velocity Graph')
xlabel('Time (sec)')
ylabel('Velocity, (m/s)')
%%Acceleration
f3=figure
acl=diff(vel);
plot(t(1:end-2),acl)
title('Acceleration Graph')
xlabel('Time (sec)')
ylabel('Acceleration, (m/s^2)')
%Torque
T=J*vel(1:end-1)*acl;
plot(t(1:end-1),T)
title('Torque')
xlabel('time (s)')
ylabel('Torque (n*m)')
%Power
pwr=J*vel(1:end-1)*acl
plot(t(1:end-2),pwr)
2 commentaires
Kennedy Oparka
le 11 Fév 2018
Modifié(e) : Kennedy Oparka
le 11 Fév 2018
Walter Roberson
le 11 Fév 2018
What size of output are you expecting?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!