I am trying to plot the 2D contour from the equation. I have tried my code. However, It does not work. I give my code below. Thank you so much!.
num=50; Lpmax=700e-6; Lpmin=20e-6; Lr=2.77e-3; Cr=2.5e-9; f=1/(2*pi*sqrt(Lr*Cr*0.5)); w=2*pi*f; T=1/f; Tdead=T*0.011; Lp_x11=linspace(Lpmin,Lpmax,num); Vs=linspace(140,340,num); Vo=180; Re_x11=200; theta=0; for i=1:num % solve the D
syms D11 X=solve(sin(D11*pi)/(2*(1-D11))-Vo/Vs(i)); D_ch=X; %
theta_dch=(2*pi*Tdead)/T; A2=(1./(Re_x11.*(pi.^2).*(1-D_ch))).*2.*w.*Lp_x11(i).*sin(pi.*D_ch).*sin(pi.*(1-D_ch)); Qlr1=(2.*Vs(i).*sin(pi.*D_ch)./(Re_x11.*pi.*(1-D_ch).*w)).*(sin(-pi.*D_ch-theta_dch)-sin(-pi.*D_ch)); Qlr2=(2.*Vs(i).*sin(pi.*D_ch)./(Re_x11.*pi.*(1-D_ch).*w)).*(sin(pi*D_ch-theta_dch)-sin(pi.*D_ch)); Qlp_S1=-(1./w).*(Vs(i).*theta_dch./(w.*Lp_x11(i))).*(A2./(1-D_ch)-pi.*D_ch+theta_dch./2); Qlp_S2=(1./w).*(D_ch.*Vs(i).*theta_dch)./(w.*Lp_x11(i).*(1-D_ch)).*(A2./D_ch+pi.*(1-D_ch)-theta_dch./2); Qs1(i)=Qlp_S1+Qlr1; Qs2(i)=Qlr2+Qlp_S2; end xv = linspace(min(Lp_x11), max(Lp_x11), 1000); zv = linspace (min (Vs), max (Vs), 1000); [X,Z] = meshgrid(xv, zv); P = griddata(Lp_x11, Vs, Qs1, X, Z); figure scatter3(x, z, p, '.') grid on figure meshc (X, Z, P) grid on figure contourf(X, Z, P) grid on
Best Answer