Matrix Division - Why am I getting a 1x1 matrix after dividing two 1x13 matrices?

4 Ansichten (letzte 30 Tage)
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 1x1 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!

Akzeptierte Antwort

Guillaume
Guillaume am 20 Jan. 2020
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

Weitere Antworten (1)

Bhaskar R
Bhaskar R am 20 Jan. 2020
You have used operatot "/". Here you need to perform elemtwise operation "./" and ".^"
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

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by