Why am i recieveing only one output even though my input is a matrix
4 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
KSSV
on 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
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!!
%<------- the above equation is changed
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
0 Comments
More Answers (0)
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!