Jika saya ingin mengintegrasikan suatu fungsi
y = -((F+h)M^3(cosh(h*M)+M*beta*sinh(h*M)))/(h*M*cosh(h*M )+(-1+h*M^2*beta)*sinh(h*M))- (alfa*(M^2*(F+h)*(-1+2*h^2*M^2 + cosh(2*h*M)-2*h*M*sinh(2*h*M)))/(8*(h*M*cosh(h*M)+(-1+h*M^ 2*beta)*sinh(h*M))^2));
terhadap x, dimana
phi = 0.6;
x = 0.5;
M = 2;
theta = -1:0.5:1.5;
F = theta - 1;
h = 1 + phi*cos(2*pi*x);
alpha = 0.2;beta = 0.0;
Saya telah menulis Mfile
function r = parameterIntegrate(F,h,M,beta,alpha,theta,phi)
% defining a nested function that uses one variable
phi = 0.6;
x = 0.5;
r = quad(@testf,0,1 + phi*cos(2*pi*x));
% simpson's rule from 0 to h
function y = testf(x)
h = 1 + phi*cos(2*pi*x);
theta = -1:0.5:1.5;
F = theta - 1;
M = 2;
beta = 0;
alpha = 0;
y = -((F+h)*M^3*(cosh(h*M)+M*beta*sinh(h*M)))/(h*M*cosh(h*M)+(-1+h*M^2*beta)*sinh(h*M))- (alpha*(M^2*(F+h)*(-1+2*h^2*M^2+ cosh(2*h*M)-2*h*M*sinh(2*h*M)))/(8*(h*M*cosh(h*M)+(-1+h*M^2*beta)*sinh(h*M))^2));
end
end
dan memanggil fungsinya dengan
tol = [1e-5 1e-3];
q = quad(@parameterIntegrate, 0, h,tol)
or
q = quad(@parameterIntegrate, 0,1 + phi*cos(2*pi*0.5),tol)
itu tidak berhasil, itu memberiku
Error using ==> plus
Matrix dimensions must agree.