Prev: matlab equalizer
Next: P code descrambler
From: naser on 23 Mar 2010 03:22 Hello everyone, I wrote a program for calculate of natural frequency of a cantilever beam with Rayleigh-Ritz method. This Program works with Chebychev Polynomial. But when I run this program, it has an error. Would you please help me how can I solve this problem? Error: ??? Error using ==> sym.maple Error, (in int) integer too large in context Error in ==> sym.int at 39 r = reshape(maple('map','int',f(:),x),size(f)); Error in ==> eulerbeam at 61 y2= subs(int(dW(i)*dW(j)),x,1)-subs(int(dW(i)*dW(j)),x,-1); %%%%%%%%%%%%%% Main Program %%%%%%%%%%%%%%%% run constant_cantiliver1 n=20; syms x z T T(1)=1; T(2)=x; for i=3:n T(i)=2*x*T(i-1)-T(i-2); end %%%%%%%%%%%%%%%% Fixed-Free %%%%%%%%%%%%%%%%%%% FFw=x^4-4*x^3+6*x^2+28*x+17; W=FFw*T; dW=diff(diff((W))); dks=L/2; %%%dx=L/2*dks M11=zeros(n,n); K11=zeros(n,n); for i=1:n for j=1:n %%Mass Matrix M11(i,j)=subs(int((W(i))*W(j)),x,1)-subs(int((W(i))*W(j)),x,-1); %%Stiffness Matrix K11(i,j)=subs(int(dW(i)*dW(j)),x,1)-subs(int(dW(i)*dW(j)),x,-1); end end M11=M11*dks; K11=K11*(1/dks)^3; M=[p*A*M11]; K=[E*I*K11]; y=eig(M^(-1)*K); y1=sort(abs(sqrt(y)))/(2*pi);
From: Walter Roberson on 23 Mar 2010 07:39 naser wrote: > Hello everyone, > I wrote a program for calculate of natural frequency of a cantilever > beam with Rayleigh-Ritz method. This Program works with Chebychev > Polynomial. But when I run this program, it has an error. Would you > please help me how can I solve this problem? > Error: > ??? Error using ==> sym.maple > Error, (in int) integer too large in context I haven't analyzed your code to see how big the numbers get, but generally speaking, Maple has a limit of about 10^(10^9) . I do remember seeing "integer too large in context" before while using smaller numbers... Ah yes, let's take a closer look at the error: > ??? Error using ==> sym.maple > Error, (in int) integer too large in context > Error in ==> sym.int at 39 > r = reshape(maple('map','int',f(:),x),size(f)); So the error is being generated by Matlab's reshape(), not by Maple, and it is basically saying that reshape cannot handle a matrix that large. That can happen with the 32 bit version of Matlab especially. I would check out the possibility that the integration might be producing an expression with millions of terms. Perhaps when you are building T(i) it might be a good idea to use T(i) = simple(2*x*T(i-1)-T(i-2)) to reduce the number of terms. Note: rather than using subs() in that context, you would be better to use Maple's eval(). The subs() you have coded will find all the x's and change them to 1's or -1's, but will not evaluate and rewrite the result by combining terms with like coefficients and such (except for the automatic simplifications). Maple's eval() evaluates the expression after the substitution is made. Maple>> subs(k=0, Int(sin(k*x),x)) Int(sin(0),x) Maple>> eval(Int(sin(k*x),x),k=0); Int(0,x) The result is less obvious with the int() you are using rather than the inert Int() I show with this example. I note that your W will contain only powers of x and constants, so your integration must be with respect to x, so you must be doing the integration first and substituting in values for x afterwards. But if that is the case, then there is no point doing the same integration twice in the same expression: instead of M11(i,j)=subs(int((W(i))*W(j)),x,1)-subs(int((W(i))*W(j)),x,-1); you could use temp - int((W(i)*W(j)); M11(i,j) = eval(temp,x,1) - eval(temp,x,-1); or something similar... except I seem to recall that the Matlab to Maple interface calls eval() something slightly different. Sorry, I'm relatively familiar with Maple but not with the renamings of functions that were required for the Matlab to Maple interface.
From: Steven Lord on 23 Mar 2010 10:51 "Walter Roberson" <roberson(a)hushmail.com> wrote in message news:hoa992$7tj$1(a)canopus.cc.umanitoba.ca... > naser wrote: >> Hello everyone, >> I wrote a program for calculate of natural frequency of a cantilever beam >> with Rayleigh-Ritz method. This Program works with Chebychev Polynomial. >> But when I run this program, it has an error. Would you please help me >> how can I solve this problem? >> Error: >> ??? Error using ==> sym.maple >> Error, (in int) integer too large in context > > I haven't analyzed your code to see how big the numbers get, but generally > speaking, Maple has a limit of about 10^(10^9) . > > I do remember seeing "integer too large in context" before while using > smaller numbers... Ah yes, let's take a closer look at the error: > > > ??? Error using ==> sym.maple > > Error, (in int) integer too large in context > > Error in ==> sym.int at 39 > > r = reshape(maple('map','int',f(:),x),size(f)); > > So the error is being generated by Matlab's reshape(), not by Maple, and > it is basically saying that reshape cannot handle a matrix that large. No. Notice that there's a call to MAPLE inside that call to RESHAPE, and from the first line of the error message we see that it is that call, not the RESHAPE, that errors. MATLAB never gets to the point where it calls RESHAPE on the symbolic result from the map function. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: naser on 26 Mar 2010 07:42 Thank you for kind reply. Would you please tell me how can I solve this problem and how can I optimum my program? Best regards "Steven Lord" <slord(a)mathworks.com> wrote in message <hoakh1$s41$1(a)fred.mathworks.com>... > > "Walter Roberson" <roberson(a)hushmail.com> wrote in message > news:hoa992$7tj$1(a)canopus.cc.umanitoba.ca... > > naser wrote: > >> Hello everyone, > >> I wrote a program for calculate of natural frequency of a cantilever beam > >> with Rayleigh-Ritz method. This Program works with Chebychev Polynomial. > >> But when I run this program, it has an error. Would you please help me > >> how can I solve this problem? > >> Error: > >> ??? Error using ==> sym.maple > >> Error, (in int) integer too large in context > > > > I haven't analyzed your code to see how big the numbers get, but generally > > speaking, Maple has a limit of about 10^(10^9) . > > > > I do remember seeing "integer too large in context" before while using > > smaller numbers... Ah yes, let's take a closer look at the error: > > > > > ??? Error using ==> sym.maple > > > Error, (in int) integer too large in context > > > Error in ==> sym.int at 39 > > > r = reshape(maple('map','int',f(:),x),size(f)); > > > > So the error is being generated by Matlab's reshape(), not by Maple, and > > it is basically saying that reshape cannot handle a matrix that large. > > No. Notice that there's a call to MAPLE inside that call to RESHAPE, and > from the first line of the error message we see that it is that call, not > the RESHAPE, that errors. MATLAB never gets to the point where it calls > RESHAPE on the symbolic result from the map function. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ >
|
Pages: 1 Prev: matlab equalizer Next: P code descrambler |