필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
Erdem Turan
Erdem Turan 2022년 11월 3일
답변: KSSV 2022년 11월 3일
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

채택된 답변

KSSV
KSSV 2022년 11월 3일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by