Help Formatting Relative Velocity Code
Mostrar comentarios más antiguos
I am working on a code to solve for the relative velocity of Vb. I then want to find the magnitude and direction of Vb. Here is a picture of the problem:

I am a little lost on part of my code and would really appreciate it if someone could point me in the right direction! I'm not looking for you do to the work for me, just tips and pointers on how to solve this and understand what it all does.
clear all; clc;
Va=80; %cm/s
r=30; %length of link, cm
theta=40*pi/180; %angle of link relative to horizontal, radians
phi=70*pi/180; %direction of Va, radians
r_= ; %r vector, B rel to A
Va_= ; %Va vector
omega_= ; %angular velocity vector, 5 rad/s CW
Vb=Va_+(omega_*r_); %relative velocity vector equation [Vb=Va+V(b/a)]
mag_Vb=abs(sqrt((Vb(1))^2+(Vb(2))^2+(Vb(3))^2));
dir_Vb=atan2(Vb(2),Vb(1)); %radians
dir_Vb=dir_Vb*180/pi; %degrees
I specifically need pointers on r_, Va_, and omega_. Also, does my Vb equation look relatively correct?
Here are the values I have for r_, Va_, and omega_:
r_=[r*cos(theta), r*sin(theta),0]
Va_=[Va*cos(phi),Va*sin(phi),0]
Would omega_=[0,0,-5] since it is going clockwise?
Thank you in advance for any and all help!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
