Docsity

Cubic Spline Rayleigh Ritz Method-Numerical Analysis-MATLAB Code, Exercises of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
function [res] = XINT(XU2,XL2,A1,B1,C1,D1,A2,B2,C2,D2,A3,B3,C3,D3)
% This function is used by Cubic Spline Rayleigh Ritz Method
% (Algoritm 11.6) to exactly integrate products of cubic
% polynomials.
syms('AA','BB','CC','DD','EE','FF','GG','XHIGH','XLOW','I');
C = zeros(1,10);
AA = A1*A2;
BB = A1*B2+A2*B1;
CC = A1*C2+B1*B2+C1*A2;
DD = A1*D2+B1*C2+C1*B2+D1*A2;
EE = B1*D2+C1*C2+D1*B2;
FF = C1*D2+D1*C2;
GG = D1*D2;
C(10) = AA*A3;
C(9) = (AA*B3+BB*A3)/2;
C(8) = (AA*C3+BB*B3+CC*A3)/3;
C(7) = (AA*D3+BB*C3+CC*B3+DD*A3)/4;
C(6) = (BB*D3+CC*C3+DD*B3+EE*A3)/5;
C(5) = (CC*D3+DD*C3+EE*B3+FF*A3)/6;
C(4) = (DD*D3+EE*C3+FF*B3+GG*A3)/7;
C(3) = (EE*D3+FF*C3+GG*B3)/8;
C(2) = (FF*D3+GG*C3)/9;
C(1) = (GG*D3)/10;
XHIGH = 0;
XLOW = 0;
for I = 1 : 10
XHIGH = (XHIGH+C(I))*XU2;
XLOW = (XLOW+C(I))*XL2;
end;
res = XHIGH-XLOW;
docsity.com

Partial preview of the text

Download Cubic Spline Rayleigh Ritz Method-Numerical Analysis-MATLAB Code and more Exercises Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

function [res] = XINT(XU2,XL2,A1,B1,C1,D1,A2,B2,C2,D2,A3,B3,C3,D3) % This function is used by Cubic Spline Rayleigh Ritz Method % (Algoritm 11.6) to exactly integrate products of cubic % polynomials. syms('AA','BB','CC','DD','EE','FF','GG','XHIGH','XLOW','I'); C = zeros(1,10); AA = A1A2; BB = A1B2+A2B1; CC = A1C2+B1B2+C1A2; DD = A1D2+B1C2+C1B2+D1A2; EE = B1D2+C1C2+D1B2; FF = C1D2+D1C2; GG = D1D2; C(10) = AAA3; C(9) = (AAB3+BBA3)/2; C(8) = (AAC3+BBB3+CCA3)/3; C(7) = (AAD3+BBC3+CCB3+DDA3)/4; C(6) = (BBD3+CCC3+DDB3+EEA3)/5; C(5) = (CCD3+DDC3+EEB3+FFA3)/6; C(4) = (DDD3+EEC3+FFB3+GGA3)/7; C(3) = (EED3+FFC3+GGB3)/8; C(2) = (FFD3+GGC3)/9; C(1) = (GGD3)/10; XHIGH = 0; XLOW = 0; for I = 1 : 10 XHIGH = (XHIGH+C(I))XU2; XLOW = (XLOW+C(I))XL2; end; res = XHIGH-XLOW;

docsity.com