# Getting error is this code, there are multiple input values of "betasqr" and "sbar" for multiple output values of Wbar, Fbar, fbar and Ybar.

1 view (last 30 days)
AVINASH SAHU on 6 Jun 2022
betasqr = [0.2 0.4];
gamma = 0.3;
psi = 0.001;
mu = 1.0;
sbar = [1/0.02 1/0.04];
a = 2;
% Steps for finding dimensionless load carrying capacity (Wbar) of the bearing
hbar = @(x) a - a.*x + x;
A = @(x) 4 .* (hbar(x) .^ 3) + sbar .* (hbar(x) .^ 4) - sbar.*betasqr.*gamma .* (hbar(x) .^ 2) .* sqrt(x .* (1-x)) ;
B = @(x) (1 + sbar .* hbar(x)) .* (1 - betasqr .* sqrt(x .* (1-x)));
G = @(x) 12 * psi + A(x) ./ B(x);
Z = @(x) 12 .* hbar(x) + 6.*sbar .* (hbar(x) .^ 2) - 2.*sbar.*betasqr.*gamma .* sqrt(x .* (1-x)) ;
E = @(x) Z(x) ./ (1 + sbar .* hbar(x));
C = @(x) E(x) ./ G(x);
IntEbyG = integral(C,0,1);
D = @(x) 1 ./ G(x);
IntGinv = integral(D,0,1);
Q = IntEbyG/IntGinv;
Wdash = @(x) x.*(E(x)-Q) ./ G(x);
IntWdash = integral(Wdash,0,1);
Wbar = (mu/12) - IntWdash
% Steps for finding dimensionless frictional force (Fbar) of the slider
I = @(x) hbar(x) .* (2 + sbar .* hbar(x)) .* (E(x) - Q );
J = @(x) 2 .* G(x) .* (1 + sbar .* hbar(x)) .* (1 - betasqr .* sqrt(x .* (1-x)));
Fdash = @(x) (sbar ./ (1 + sbar .* hbar(x))) + I(x) ./ J(x);
Fbar = integral(Fdash,0,1)
% Steps for finding coefficient of friction (fbar)
fbar = Fbar/Wbar % Coefficient of friction
% Steps for finding dimensionless form of x coordinate of center of pressure(Ybar)
L = @(x) (x.^2).*(E(x)-Q) ./ G(x);
IntL = integral(L,0,1);
Ybar = ((mu/24)-(0.5*IntL)) / Wbar
getting the following error:
Arrays have incompatible sizes for this operation.
Error in table1inclinea>@(x)12.*hbar(x)+6.*sbar.*(hbar(x).^2)-2.*sbar.*betasqr.*gamma.*sqrt(x.*(1-x)) (line 13)
Z = @(x) 12 .* hbar(x) + 6.*sbar .* (hbar(x) .^ 2) - 2.*sbar.*betasqr.*gamma .* sqrt(x .* (1-x)) ;
Error in table1inclinea>@(x)Z(x)./(1+sbar.*hbar(x)) (line 14)
E = @(x) Z(x) ./ (1 + sbar .* hbar(x));
Error in table1inclinea>@(x)E(x)./G(x) (line 15)
C = @(x) E(x) ./ G(x);
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);
Error in table1inclinea (line 16)
IntEbyG = integral(C,0,1);