
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is solution to one of problems in Numerical Analysis. This is matlab code. Its helpful to students of Computer Science, Electrical and Mechanical Engineering. This code also help to understand algorithm and logic behind the problem. This code includes: Composite, Simpsons, Rule, Function, Method, Algorithm, Piecewise, Rayleigh, Ritz, Inline, Result
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!

function [res] = SIMPSON(FN,A,B,sqq,sf,sp) % This function is used by the Piecewise Linear Rayleigh Ritz % Method (Algorithm 11.5) to perform Composite Simpson's Rule syms('H','I','Y','Z','x'); QQ = inline(sqq,'x'); P = inline(sp,'x'); F = inline(sf,'x'); H = (B-A)/4; Z = zeros(1,5); for I = 0 : 4 Y = A+IH; if FN == 1 Z(I+1) = (4-I)IHHQQ(Y); end; if FN == 2 Z(I+1) = (IH)(IH)QQ(Y); end; if FN == 3 Z(I+1) = (H(4-I))(H(4-I))QQ(Y); end; if FN == 4 Z(I+1) = P(Y); end; if FN == 5 Z(I+1) = IHF(Y); end; if FN == 6 Z(I+1) = (4-I)HF(Y); end; end; res = (Z(1)+Z(5)+2Z(3)+4(Z(2)+Z(4)))H/3;