i want to plot two coordinate positions (complex)

2 次查看(过去 30 天)
Im working on a project (analysis of four bar linkages) i have two vectors that i would like to plot but dont know how. the vectors i wish to plot are R_A and R_P. shown below my code:
clc, clear
global L1 L2 L3 L4 AP delta
L1=5;
L2=1;
L3=5;
L4=7;
AP=5;
delta=50;
% Because we want theta2 to range from 0-360 (1rev) and the increment will be 360/200
theta2=0:360/200:360;
theta1=0;
%loop variables
R2=L2*exp(1i*deg2rad(theta2));
%R3=L3*exp(1i*deg2rad(theta3));
%R4=L4*exp(1i*deg2rad(theta4));
R1=L1*exp(1i*deg2rad(theta1));
Z=R1-R2;
Z_con=conj(Z);
%variables of the quadratic equation
a=L4*Z_con;
b=Z.*Z_con+L4^2-L3^2;
c=Z*L4;
%solution of the equation
T=roots([a b c]);
S=(L4*T+Z)/L3;
%angular positions
theta4=rad2deg(angle(T));
theta3=rad2deg(angle(S));
theta_AP=theta3-delta;
%path coordinates of A and P
R3=L3*exp(1i*deg2rad(theta3));
R4=L4*exp(1i*deg2rad(theta4)); %not needed
R_AP=AP*exp(1i*deg2rad(theta_AP));
R_A=R2;
R_P=R2+R_AP;
size(R_A)
ans = 1×2
1 201
size(R_P)
ans = 1×2
602 201
  1 个评论
Dyuman Joshi
Dyuman Joshi 2023-10-30
Do you mean like this?
L1=5;
L2=1;
L3=5;
L4=7;
AP=5;
delta=50;
% Because we want theta2 to range from 0-360 (1rev) and the increment will be 360/200
theta2=0:360/200:360;
theta1=0;
%loop variables
R2=L2*exp(1i*deg2rad(theta2));
%R3=L3*exp(1i*deg2rad(theta3));
%R4=L4*exp(1i*deg2rad(theta4));
R1=L1*exp(1i*deg2rad(theta1));
Z=R1-R2;
Z_con=conj(Z);
%variables of the quadratic equation
a=L4*Z_con;
b=Z.*Z_con+L4^2-L3^2;
c=Z*L4;
%solution of the equation
T=roots([a b c]);
S=(L4*T+Z)/L3;
%angular positions
theta4=rad2deg(angle(T));
theta3=rad2deg(angle(S));
theta_AP=theta3-delta;
%path coordinates of A and P
R3=L3*exp(1i*deg2rad(theta3));
R4=L4*exp(1i*deg2rad(theta4)); %not needed
R_AP=AP*exp(1i*deg2rad(theta_AP));
R_A=R2;
R_P=R2+R_AP;
size(R_A)
ans = 1×2
1 201
size(R_P)
ans = 1×2
602 201
plot(R_A,R_P)
Warning: Imaginary parts of complex X and/or Y arguments ignored.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by