Azzera filtri
Azzera filtri

Why am i recieveing only one output even though my input is a matrix

2 visualizzazioni (ultimi 30 giorni)
clear all
close all %hertzian contact calculator for a sphere
clc;
format long
F= 5000 ;
v1=0.3;
v2=0.3;
E1=700000
E2=700000;
d1=10 ;
d2=100 ;
b=(1/d1)+(1/d2)
m1=(1-v1^2)/E1
m2=(1-v2^2)/E2
a0=0.76241947
a=[ 0.182 : 0.1 : 2.286];
z=[];
U=[];
Q=[];
OK=[];
Pmax=[];
qxy=[];
Pmax=(3*F)./(2*pi*(a.^2));
z= 0.48.*a;
U=(2.*(1+(z.^2/a.^2))) %for simplification of qxy equation --> should not provide only one output!
Q= (1./U); %for simplification of qxy equation
OK=(1-(abs(z./a)*(atan(1/(z./a))))) %for simplification of qxy equation --> does not divide due to a matrix erorr!!
qxy=-Pmax.*(((OK).*(1+v1))-Q)
plot(a,Pmax)
% I am trying to make a hertzian contact stress calculator for spheres
% i need to find "qxy" values for each iteration of "a" but i dont understand
% why the "u" variable creates only one output. After that i also need to plot "qxy" with a values.
% I would really appriciate your solution to my issue and also a feedback
% for the code would really be appriciated. thank you in advance

Risposta accettata

KSSV
KSSV il 3 Nov 2022
You need to use element by element operations.
clc; clear all ;
clear all
close all %hertzian contact calculator for a sphere
clc;
format long
F= 5000 ;
v1=0.3;
v2=0.3;
E1=700000
E1 =
700000
E2=700000;
d1=10 ;
d2=100 ;
b=(1/d1)+(1/d2)
b =
0.110000000000000
m1=(1-v1^2)/E1
m1 =
1.300000000000000e-06
m2=(1-v2^2)/E2
m2 =
1.300000000000000e-06
a0=0.76241947
a0 =
0.762419470000000
a=[ 0.182 : 0.1 : 2.286];
z=[];
U=[];
Q=[];
OK=[];
Pmax=[];
qxy=[];
Pmax=(3*F)./(2*pi*(a.^2));
z= 0.48.*a;
U=(2.*(1+(z.^2/a.^2))) %for simplification of qxy equation --> should not provide only one output!
U =
2.460800000000000
Q= (1./U); %for simplification of qxy equation
OK=(1-(abs(z./a).*(atan(1./(z./a))))) %for simplification of qxy equation --> does not divide due to a matrix erorr!!
OK = 1×22
0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891 0.460827351213891
%<------- the above equation is changed
qxy=-Pmax.*(((OK).*(1+v1))-Q)
qxy = 1×22
1.0e+04 * -1.388860236730426 -0.578499653959291 -0.315264154501375 -0.198019173574227 -0.135817380762682 -0.098908262057986 -0.075229437407949 -0.059137661881442 -0.047706586667405 -0.039295860067325 -0.032928076878973 -0.027991441853881 -0.024087139845072 -0.020946183933454 -0.018381813768302 -0.016261078157571 -0.014487248870252 -0.012988592211877 -0.011711001048146 -0.010613041679576 -0.009662551633072 -0.008834257217338
plot(a,Pmax)
% I am trying to make a hertzian contact stress calculator for spheres
% i need to find "qxy" values for each iteration of "a" but i dont understand
% why the "u" variable creates only one output. After that i also need to plot "qxy" with a values.
% I would really appriciate your solution to my issue and also a feedback
% for the code would really be appriciated. thank you in advance

Più risposte (0)

Categorie

Scopri di più su Structures in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by