Code not working in APPDESIGNER...Only change is ifelse statement

1 visualización (últimos 30 días)
Aishwarya Vyas
Aishwarya Vyas el 28 de Nov. de 2019
Editada: Aishwarya Vyas el 28 de Nov. de 2019
R1=app.R1mmEditField.Value;
R2=app.R2mmEditField.Value;
L=app.LmmEditField.Value;
E1=app.ElasticModulusbody1Nmm2EditField.Value;
E2=app.ElasticModulusbody2Nmm2EditField.Value;
v1=app.PoissonsRatiobody1EditField.Value;
v2=app.PoissonsRatiobody2EditField.Value;
F=app.ForceEditField.Value;
if app.GEOMETRIESDropDown.Value=="CYLvsCYL"
% Defining geometrical parameters of Cylinder
%Calculating the contact half width
A=(4*F)/(3.14*L); Error using /Matrix dimensions must agree.
L1=(1/R1)+(1/R2);
Etot=(((1-v1^2)/E1)+((1-v2^2)/E2));
b=((A*Etot)/L1)^0.5;
%Calculating the pressure max
Pmax=2*F/(pi*b*L);
%Calculating the penetration depth;
app.PRESSUREMAXEditField.Value=Pmax;
app.EllipticalAxisEditField.Value=b;
elseif app.GEOMETRIESDropDown.Value=="SPHvsSPH"
%Calculating the contact half width
A=(3*F)/4;
Etot=(((1-v1^2)/E1)+((1-v2^2)/E2));
M=(1/R1)+(1/R2);
b=((A*Etot)/M)^(1/3);
%Calculating the pressure max
Pmax=(3*F)/(2*pi*b*b);
%Calculating the penetration depth;
%http://home.ufam.edu.br/berti/nanomateriais/8403_PDF_CH03.pdf
app.PRESSUREMAXEditField.Value=Pmax;
app.EllipticalAxisEditField.Value=b;
elseif app.GEOMETRIESDropDown.Value=="CYLvsPLATE"
%Calculating the contact half width
A=(4*F*R1)/(pi*L);
Etot=(((1-v1^2)/E1)+((1-v2^2)/E2));
b=(A*Etot)^0.5;
%Calculating the pressure max
Pmax=2*F/(pi*b*L);
%Calculating the penetration depth;
%http://home.ufam.edu.br/berti/nanomateriais/8403_PDF_CH03.pdf
%Below equation is valid only for steel..No equation is available
app.PRESSUREMAXEditField.Value=Pmax;
app.EllipticalAxisEditField.Value=b;
elseif app.GEOMETRIESDropDown.Value=="SPHvsPLATE"
%Calculating the contact half width
A=(3*F)/4;
Etot=(((1-v1^2)/E1)+((1-v2^2)/E2));
M=(1/R1)+(1/R2);
b=((A*Etot)/M)^(1/3);
%Calculating the pressure max
Pmax=(3*F)/(2*pi*b*b);
app.PRESSUREMAXEditField.Value=Pmax;
app.EllipticalAxisEditField.Value=b;
end
The error is as highlighted.
My question is why is a matrix variable formed .I can solve using ./ but it should be declared as a scalar right?

Respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by