The plot provided by the program is required for the evaluation of the E(S) along with the variable used in the code. The code is as follows;
function TestSmooth(lambda,a,b,AbsTol,RelTol,c) behavior =1; if nargin < 4 || isempty(AbsTol) AbsTol = 1e-6; end if nargin < 5 || isempty(RelTol) RelTol = 1e-3; end if nargin < 6 || isempty(c) c = -1; end % Compute and plot the solution:
[soln,errest,cond] = Fie(lambda,a,b,behavior,@kernel,@RHS,AbsTol,RelTol); t = soln.s; sol = soln.x; nfinal = length(t) - 1; % Interpolate the solution for assessing the error and if necessary,
% use to get a smooth graph.
tint = linspace(a,b,150); xint = ntrpFie(soln,tint); if nfinal < 150 plot(tint,xint) h = findobj(gca,'Type','line'); x1=get(h,'Xdata'); y1=get(h,'Ydata'); J=@(S)bessel(0,S./aa.*aa.*x1.^2); J1=@(S)(x1.^2).*y1.*J(S); int=trapz(x1,J1(S)); E=((pi.*aa.*aa.*1e-6)./(210e9)).*int; disp (E); else plot(t,sol) end %====Nested functions=======================================================
function kst = kernel(s,t) nn=8; l=1*17.6e-6; % microstructural characteristic length
aa=17.6e-6;% crack length
h=10*aa;% half-height of the plate
a_est=@(S)1+(1./((S./aa).^2.*(l.^2)));%a* exp(-2.*h.*sqrt(((S./aa)).^2+(1./l.^2))
b_est1=@(S)exp(-(S./aa).*h)-exp(h.*sqrt(((S./aa)).^2+(1./l.^2))); b_est2=@(S)-exp(-h.*sqrt(((S./aa)).^2+(1./l.^2)))+exp(h.*sqrt(((S./aa)).^2+(1./l.^2))); b_est=@(S)b_est1(S)./b_est2(S);%b*
P1=@(S)(((1+exp(-2.*(S./aa).*h))./a_est(S))) P2=@(S)exp(-2.*h.*sqrt((S./aa).^2+(1./l.^2))); P3=@(S)1./(1+(exp(-2.*(S./aa).*h)).*P2(S)); P=@(S)P3(S).*((1+exp(-2.*(S./aa).*h))-P1(S)); F3=@(S)(1-exp(-2.*(S./aa).*h))./(P(S).*(1+exp(-2.*(S./aa).*h))); f21=@(S)S.*(F3(S)-1).*besselj(0,S.*s.^2).*besselj(0,S.*t.^2); f2=@(S)-2.*t.*s.*t.*f21(S); kst=galag(f2,nn); end % kernel
function ts = true_soln(t) ts = 0; end % true_soln
function rs = RHS(s) rs=s; end % RHS
end
It showed me the following error
Undefined function or variable 'S'.
Error in TestSmooth (line 48) int=trapz(x1,J1(S));
Thanks in advance.
Best Answer