MATLAB: Trying to solve a transcendental equation by graphing

fiber opticstranscendental equation

This graph represents the number of modes in a fiber. Essentially i would like to learn how to plot these equations, except i am only learning matlab and i cant seem to find how to run multiple instances of the value m, along with the adding on to the graph the RHS equation. Also when i run my code, my RHS or 'g' does not come out as an array.. So recap 2 equations in one plot, and multiples of the same equation, and my math for g is not coming out right.
Thanks for any help!
clc; clear;
nr = 1.5; %glass refractive index
ni = 1; %air refractive index
lambda = 10^(-2); % wavelength
d = 10^(-2); %thickness
theta = 0:1:50;
m = 0:1:5
f = tand(pi*nr*sind(theta) - pi.*m/2);
g = ((sqrt(cosd(theta)).^2 - nr^2))/(sind(theta))
plot(theta, f); %i want to plot both though in one

Best Answer

angf = bsxfun(@minus, pi*nr*sind(theta), pi.*m/2 );
f = tand( angf );
g = ((sqrt(cosd(theta)).^2 - nr^2)) ./ (sind(theta))