After this I want to integrate P1 from 0 to x (let's say this function to be P2) and then again integrating the function P2 from 0 to 1. I don't know how to proceed.

% For plane slider: H = Ho + a(1-x)
Ho = 1;
alpha = 0.1;
eps = 0.1;
a = 1.0;
lbar = 0.1;
sigma = 0.05;
H = @(x) Ho + a*(1 - x);
G1 = @(x) H(x).^3 + 3 .* H(x).^2 .* alpha + 3*sigma^2*alpha + alpha^3 - 12*lbar^3*(H(x) + alpha);
G2 = @(x) 24 * lbar^3 .* tanh(H(x)./(2*lbar));
G3 = @(x) (12*lbar^2*alpha - eps - alpha^3 - 3*sigma^2*alpha) .* (1 - (tanh(H(x)./(2*lbar))).^2);
G = @(x) G1(x) + G2(x) + G3(x);
Hm1 = @(x) H(x).* (1 ./ G(x));
Hm2 = @(x) (1 ./ G(x));
IntHm1 = integral(Hm1,0,1);
IntHm2 = integral(Hm2,0,1);
Hm = IntHm1 / IntHm2
P1 = @(x) 6 .* (1 ./ G(x)) .* (H(x) - Hm);

 Accepted Answer

% For plane slider: H = Ho + a(1-x)
Ho = 1;
alpha = 0.1;
eps = 0.1;
a = 1.0;
lbar = 0.1;
sigma = 0.05;
H = @(x) Ho + a*(1 - x);
G1 = @(x) H(x).^3 + 3 .* H(x).^2 .* alpha + 3*sigma^2*alpha + alpha^3 - 12*lbar^3*(H(x) + alpha);
G2 = @(x) 24 * lbar^3 .* tanh(H(x)./(2*lbar));
G3 = @(x) (12*lbar^2*alpha - eps - alpha^3 - 3*sigma^2*alpha) .* (1 - (tanh(H(x)./(2*lbar))).^2);
G = @(x) G1(x) + G2(x) + G3(x);
Hm1 = @(x) H(x).* (1 ./ G(x));
Hm2 = @(x) (1 ./ G(x));
IntHm1 = integral(Hm1,0,1);
IntHm2 = integral(Hm2,0,1);
Hm = IntHm1 / IntHm2;
P1 = @(x) 6 .* (1 ./ G(x)) .* (H(x) - Hm);
fun = @(x)integral(@(u)P1(u),0,x);
result = integral(fun,0,1,'ArrayValued',true)
result = 0.1310

More Answers (0)

Categories

Find more on Software Development 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!