MATLAB: Plotting the following equation L=((N^2)*m​uo*Ag1)/(x​+((g*R)/(2​*h)))

plot

I am new to matlab and need help plotting the following equation L=((N^2)*muo*Ag1)/(x+((g*R)/(2*h))) against x where x varies from xmin to xmax in steps of 0.0001m.
My parameters are as follows: R=0.065; h=0.0319; g=0.00055; xmin=0.0011; xmax=0.0187; N=2470; muo=4*pi*1e-7; Ag1=pi*R^2;
I have tried the following code with no luck: x=[xmin:0.0011:xmax] plot=(x*1000,L);xlabel=('position x (mm)'); x is multiplied by 1000 here to get value of x in mm rather than in m which are used in the equations.
Any help appreciated.
Regards
Mark

Best Answer

Your code works except for your not vectorising the division (replace ‘/’ with ‘./’) in the ‘L’ calculation:
L=((N^2)*muo*Ag1)./(x+((g*R)/(2*h)));