i want to plot two coordinate positions (complex)
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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)
size(R_P)
1 Commento
Dyuman Joshi
il 30 Ott 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)
size(R_P)
plot(R_A,R_P)
Risposte (0)
Vedere anche
Categorie
Scopri di più su Line Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!