I can't use "quadl"
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, i'm trying to use the "quadl" to do an integration, but it just doesn't work, at the last 2 lines. Please help. Thanks.
a=1;
b=2;
kx=1;
ky=0;
k=sqrt((kx^2)+ky^2);
ka=k*a;
kb=k*b;
g=9.81;
A=1;
h=10;
z=0;
t=0;
omega=g*k*tanh(k*h);
elenum1=1;
elenum2=2;
elenum=(2*elenum1)+(elenum2);
node=elenum*2+1;
x0=a;
y0=a;
syms eta eta0 eta1 eta2
xeta1=eta;
yeta1=-y0;
xeta2=(b*(cos((eta-eta1)/b)))-x0;
yeta2=b*sin((eta-eta1)/b)-y0;
xeta3=-x0;
yeta3=b-eta-eta1-eta2-y0;
J1=abs(diff(yeta1,eta)*(xeta1)-(yeta1)*(diff(xeta1,eta)));
J2=abs(diff(yeta2,eta)*(xeta2)-(yeta2)*(diff(xeta2,eta)));
J3=abs(diff(yeta3,eta)*(xeta3)-(yeta3)*(diff(xeta3,eta)));
b11=((1/J1)*[diff(yeta1,eta),-diff(xeta1,eta)])';
b12=((1/J2)*[diff(yeta2,eta),-diff(xeta2,eta)])';
b13=((1/J1)*[diff(yeta3,eta),-diff(xeta3,eta)])';
b21=((1/J1)*[(-yeta1),(xeta1)])';
b22=((1/J2)*[(-yeta2),(xeta2)])';
b23=((1/J3)*[(-yeta3),(xeta3)])';
LS=(b-a)/(elenum1*2);
LC=(2*pi*b)/(2*elenum2*4);
eta1S=eta0+LS;
eta1C=eta0+LC;
eta2S=eta0+2*LS;
eta2C=eta0+2*LC;
N0S=[(((eta-eta1S)*(eta-eta2S))/(2*LS^2)),(((eta-eta0)*(eta-eta2S))/(-LS^2)),(((eta-eta0)*(eta-eta1S))/(2*LS^2))];
N0C=[(((eta-eta1C)*(eta-eta2C))/(2*LC^2)),(((eta-eta0)*(eta-eta2C))/(-LC^2)),(((eta-eta0)*(eta-eta1C))/(2*LC^2))];
B11=b11*N0S;
B12=b12*N0C;
B13=b13*N0S;
B21=b21*(diff(N0S,eta));
B22=b22*(diff(N0C,eta));
B23=b23*(diff(N0S,eta));
e01=(B11)'*B11*J1;
E01=quadl(@e01,eta0,eta1S);
0 comentarios
Respuestas (1)
Walter Roberson
el 30 de Abr. de 2012
You cannot do numeric integration of a symbolic expression.
I would have suggested that you consider using matlabFunction() to turn the symbolic expression into a numeric function, but your integration bounds are symbolic, and it is not possible to do numeric integration with symbolic bounds.
Perhaps you are looking for int() instead of quadl() ?
2 comentarios
Walter Roberson
el 30 de Abr. de 2012
Make your main routine a function rather than a script.
In order to use B11 and J1 in your function e01, you would have to pass them in to the function, or you would have to use nested functions.
Your function e01 should be
function R = e01(eta,eta0,eta1,eta2)
R = (B11)'*B11*J1;
However, as best I recall, quadl will not pass in four arguments to the called function. What exactly is the point of passing anything in to the called function if you are going to ignore the values passed in?
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!