MATLAB Answers

0

jumping curves problem and polygon trace

Asked by Aamna Alshehhi on 3 Oct 2019 at 14:01
so i got this code to plot Th2 vs Th3 and Th2 vs Th4 but i have a problem of jumping curves because i get two values of Th3 every itiration ,also for Th4 so i wanna sparate these values to get a continues curve. also i wanna plot figure 3 (patch command) from Th2=0 to 90 not to 360 but i am not sure how to do this. any suggestions?
for i=0:360
d =3.5; a = 1;b = 2; c = 4;
Th1= 0;
Z = d*exp(1i*deg2rad(Th1))- a*exp(1i*deg2rad(i));
Zc = conj(Z);
Ka = c*Zc; Kb = Z*Zc + c^2 -b^2; Kc = c*Z;
T = roots([ Ka Kb Kc]);
S = (c*T+Z)/b;
Th3(:,i+1) = rad2deg(angle(S));
Th4 (:,i+1) = rad2deg(angle(T));
P= a*exp(1i* deg2rad(Th2))+ 6*exp(1i* deg2rad(Th3-20));
B= a*exp(1i* deg2rad(Th2))+ 2*exp(1i* deg2rad(Th3));
A= a*exp(1i* deg2rad(Th2));
end
Th2 = 0:360;
figure(1)
plot (Th2,Th3(1,:));
hold on;
plot (Th2,Th3(2,:));
xlabel ('TH)')
ylabel ('TH3')
figure(2)
plot (Th2,Th4(1,:));
hold on;
plot (Th2,Th4(2,:));
xlabel ('TH2') ;
ylabel ('TH4') ;
figure (3);
patch( [real(P); real(B); real(A)] , [imag(P); imag(B); imag(A)] ,[1 1 1])
Bnew = downsample(B,5);
Anew = downsample(A,5);
Pnew = downsample(P,5);

  0 Comments

Sign in to comment.

0 Answers