Borrar filtros
Borrar filtros

i want to plot two coordinate positions (complex)

2 visualizaciones (últimos 30 días)
shamma aljaberi
shamma aljaberi el 29 de Oct. de 2023
Comentada: Dyuman Joshi el 30 de Oct. de 2023
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 comentario
Dyuman Joshi
Dyuman Joshi el 30 de Oct. de 2023
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by