MATLAB: Matrix Division – Why am I getting a 1×1 matrix after dividing two 1×13 matrices

figureMATLABplot

Hello there,
I am trying to plot three different curves that are functions of the same variables to try and compare the three in terms of their output (the three equations are yield models – poisson, and two Murphy's yield model equations). I have used the following as my code:
A = 0.000036:0.000001:0.000048 ; %Die Area = 36 mm^2, now converted to m^2%
D = 7000; %Defect density = 0.7/cm^2 now converted to defects/m^2%
y_poisson = exp(-A*D);
plot(A,y_poisson) %plots the poisson yield model%
hold on
y_MurphyFirst =(1 - exp(-2*A*D))/(2*A*D);
plot(A,y_MurphyFirst) %plots the Murphy's First equation yield model%
y_MurphySecond = ((1 - (exp(-A*D)))/(A*D))^2;
plot(A,y_MurphySecond) %plots the Murphy's Second equation yield model%
hold off
After running that code, only the first plot for y_poisson plots, the other two, y_MurphyFirst and y_MurphySecond appear as 1×1 matrices in the workspace hence I get no plot. Am thinking that the problem is with my division in
y_MurphyFirst =(1 - exp(-2*A*D))/(2*A*D);
and
y_MurphySecond = ((1 - (exp(-A*D)))/(A*D))^2
I'd appreciate some help in writing the two equations in their correct matlab sytax. The two equations are: Y = (1 − ?^(−2??))/2?? and
Y = ((1 − ?^(−??))/A?)^2 respectively.
Thanks in advance!

Best Answer

The / operator solves a system of linear equation. If you want to perform elementwise division you need to use the dotted operators:
y_MurphyFirst =(1 - exp(-2*A*D))./(2*A*D);
y_MurphySecond = ((1 - (exp(-A*D)))./(A*D))^2