How to plot loop array against equations (Equations not intersecting if placed in a array for-loop)- see the image attached
显示 更早的评论
I need to graphically obtain two equation intersection on a array vector and store it for plotting. I have achieved the plot but the intersection is not at the required place and doesn't match the analysis on my paper. There is something which i am missing out. the last code in the script indicates on the plot where the equations must meet as per the anaylsis i did on paper and the image attached.

the equation is for Ki, Lambda with a delay plant
clear all; close all; clf; clc
tc2=0.4; %Time constant value
delay2=0.01; %Delay
wc=10;
phasemargin=50;
h=1;
for lambda=0:0.001:2;
%Equation 1
t=tan(atan(wc*tc2)+phasemargin+delay2*wc);
M=(((wc^(-lambda))*(sin((lambda*pi)/2)))+((wc^(-lambda))*(cos((lambda*pi)/2)*t)));
ki(h)=-t/M; %Equation 1
%Quadratic Equation 2
A=(tc2/(1+((wc*tc2)^2)))+delay2;
B=2*A*(wc^(-lambda))*cos((lambda*pi)/2)-(lambda*(wc^(-lambda-1))*sin((lambda*pi)/2));
a=A; b=B; c=wc^(-2*lambda);
ki1(h)= (-b+sqrt(b^2-4*(a^2)*c))/(2*a*c); %Equation 2
lms(h)=lambda;
h=h+1;
end
figure(1);
plot(lms,ki,'r', 'Linewidth',1);hold on
plot(lms,ki1,'k-','Linewidth',1);hold on;
%this codes will tell where the equation must intersect.
plot(0.8731,11.059,'ro', 'MarkerSize', 10)
axis([0 2.5 -5 15])
If I remove the lambda array from lambda 0:0.001:2 and place lambda=0.8731 then ki=11.059 is the output similar to the graph i want to obtain.
Please help me identify and obtain the graph at the intersection on the red circle for lambda and Ki values.
Thank you!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 2-D and 3-D Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!