Hi I want to plot the transcendental equation for dielectric waveguide the equation for that is

3 views (last 30 days)
tan(x)=sqrt(v^2-x^2)/x where v is 8.219. the hand made plot is in the figure I know the basics but still couldn't figure out. any help would be appreciated.
  4 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 30 Oct 2014
This should get you started:
v = 8.219;
wvgd = @(x) sqrt(v^2-x.^2)./x;
intx = @(x) tan(x) - wvgd(x);
x = linspace(0,2.5*pi,500);
xi = 1:max(x);
for k1 = 1:length(xi)
itx(k1) = fzero(intx, xi(k1)); % Find Intersections Of tan(x) & wvgd(x)
end
itx = unique(itx);
figure(1)
plot(x, wvgd(x))
hold on
plot(x, tan(x))
plot(itx, tan(itx), 'pr', 'MarkerSize',7)
hold off
grid
axis([0 max(x) -50 50])
lblx = strsplit(sprintf('(%.2f,%.2f) ', [itx; tan(itx)]));
text(itx, tan(itx), lblx(1:length(itx)), 'VerticalAlignment','bottom', 'HorizontalAlignment','center')
This gives you the upper curve and the values of its intersection with your waveguide equation. I know nothing about waveguide engineering, so I don’t know how to calculate the lower curve you drew. I have to leave that for you.
  2 Comments
guru
guru on 30 Oct 2014
Hey thank you so much. the other curve is for the equation tan(x) = x/sqrt(v^2-x^2). and I also need to include v= 8.219 line which should be vertical. can you help me adding that too? as I am struggling.
Star Strider
Star Strider on 30 Oct 2014
Edited: Star Strider on 30 Oct 2014
My pleasure!
Easy enough to add those lines to the code:
v = 8.219; % Asymptote
wvgd1 = @(x) real(sqrt(v^2-x.^2)./x); % Upper Curve
wvgd2 = @(x) -real(x./sqrt(v^2-x.^2)); % Lower Curve
intx1 = @(x) max(tan(x),0) - wvgd1(x); % Upper Intersection Function
intx2 = @(x) min(tan(x),0) - wvgd2(x); % Lower Intersection Function
dtanx = @(x) 1 + tan(x).^2; % Derivative of Tangent
x = linspace(0,v,500);
xi = 1:0.1:v; % Initial Estimate Vector
for k1 = 1:length(xi)
itx1(k1) = fzero(intx1, xi(k1)); % Find Intersections Of tan(x) & wvgd1(x)
itx2(k1) = fzero(intx2, xi(k1)); % Find Intersections Of tan(x) & wvgd1(x)
end
itx1((itx1 >= v) | (abs(tan(itx1)) > 10)) = []; % Delete Out-Of-Bounds Data
itx2((itx2 >= v) | (abs(tan(itx2)) > 10)) = []; % Delete Out-Of-Bounds Data
itx1 = itx1(diff([0 itx1])>1E-3); % Delete Near-Duplicate Entries
itx2 = itx2(diff([0 itx2])>1E-3); % Delete Near-Duplicate Entries
ytan = tan(x);
ytan(dtanx(x) > 1000) = NaN; % Eliminate Singularities From Plot
figure(1)
plot(x, wvgd1(x))
hold on
plot(x, wvgd2(x))
plot(x, ytan)
plot(itx1, tan(itx1), 'pb', 'MarkerSize',7,'MarkerFaceColor','b')
plot(itx2, tan(itx2), 'pb', 'MarkerSize',7,'MarkerFaceColor','b')
plot([v;v],ylim,'LineWidth',2)
hold off
grid
axis([0 max(x)+0.1 -10 10])
lblx1 = strsplit(sprintf('(%.2f,%.2f) ', [itx1; tan(itx1)]));
text(itx1, tan(itx1)+0.2, lblx1(1:length(itx1)), 'VerticalAlignment','bottom', 'HorizontalAlignment','right','FontSize',7)
lblx2 = strsplit(sprintf('(%.2f,%.2f) ', [itx2; tan(itx2)]));
text(itx2, tan(itx2)-0.2, lblx2(1:length(itx2)), 'VerticalAlignment','top', 'HorizontalAlignment','right','FontSize',7)
with the plot:
The ‘itx1’ and ‘itx2’ variables are the x-coordinates of the intersections. The values of the intersections at those points are the tangents of those values. The red vertical line at ‘v’ is the asymptote you requested.
(The most meaningful expression of appreciation here on MATLAB Answers is to Accept the answer that most closely solves your problem.)

Sign in to comment.

More Answers (1)

guru
guru on 31 Oct 2014
Thanks a tonn.... "Star Strider" ....
  3 Comments
Star Strider
Star Strider on 31 Oct 2014
In that instance, the function changes to:
fv = @(x) [(22.2E+3)*sin((161E+4).*x).*(x<d2) + (42.32E+9)*exp(-2.896E+6.*x).*(x>=d2)];
and the plot is:

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!