Help Formatting Relative Velocity Code
7 ビュー (過去 30 日間)
古いコメントを表示
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!
0 件のコメント
採用された回答
James Tursa
2018 年 9 月 19 日
編集済み: James Tursa
2018 年 9 月 19 日
Using your picture, I just called the rotational part of the velocity Vr.
I agree with your Va_ equation for the components, and also Vb_ = Va_ + Vr
For Vr, a simple calculation gives the angle of the Vr vector = 270 deg + theta
Then do your usual cos( ) and sin( ) stuff with this angle along with the magnitude to get Vr.
What sign of omega to use? The way I drew the picture for Vr and the fact that I have 270 deg as part of the angle for Vr, you use a positive value for omega. This was done so that the Vr direction would match the arrow direction of omega in the drawing. But had I used theta + 90 deg for the Vr angle and drawn Vr going up to the left instead of down to the right, then you would use a negative value for omega. Perhaps this would make more sense generally. You can take your pick. You will get the same result either way. Normally one would expect omega = theta_dot which is backwards of what the drawing has. That to me is just a point of confusion that isn't needed. I would have drawn the omega arrow the other way.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Mathematics and Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!