help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: R: [bug #31571] matrix incorrect build


From: Ben Abbott
Subject: Re: R: [bug #31571] matrix incorrect build
Date: Tue, 09 Nov 2010 17:06:22 +0800

On Nov 9, 2010, at 4:53 PM, address@hidden wrote:
> 
>> ----Messaggio originale----
>> Da: address@hidden
>> Data: 07/11/2010 10.09
>> A: "Ben Abbott"<address@hidden>, "Nino"<address@hidden>, <octave-bug-
> address@hidden>
>> Ogg: [bug #31571] matrix incorrect build
>> 
>> 
>> Follow-up Comment #1, bug #31571 (project octave):
>> 
>> Running Matlab I see ...
>> 
>>>> Rext = [];
>>>> whos Rext
>> Name      Size            Bytes  Class     Attributes
>> 
>> Rext      0x0                 0  double              
>> 
>>>> Ibox = Rext * [0, 1; 1, 1]
>> ??? Error using ==> mtimes
>> Inner matrix dimensions must agree.
>> 
>> Please confirm that your variable, Rext, is supposed to be empty.
> 
> Dear Ben
> the Rext variabile is not empty since the variables calculated in the 
> previuos 
> parts of the mfile which calls the function are correct
> and the input variablles " geo, N r0 Rext ratio dimension" are given by 
> keyboard 
> all the mfiles worked with Matlab 6.5 and now I would like to reuse them
> best regards
> Nino
> ////////////////////////////listing of the calling mfile
> disp('startg+urid+coeff+nlintool-quadrupoler')
> system("del neumann.dat");%!del neumann.dat
> %input parameters 
> %geo, N, r0, Rext; ratio, dimension
> %clear all %------------------------------------
> %hold off
> tic
> %geo=3%------------------------
> %N=800;
> %r0=1;
> %Rext=3.54*r0; 
> %Rext=2*r0;
> %Rext=5.5*r0;
> %ratio=0.6;% 1.12;%------------------------------- bar size
> rbar=ratio*r0;
> %dimension=0.3 %------------------------------
> hyper=3.8;
> thick=0.0*r0;%thick=0.2*r0;
> if geo==2,
>    dimen=dimension*r0;
> elseif geo==4,
>    dimen=dimension*rbar;
>    %thick=0.1*rbar;
> elseif geo==3,
>    dimen=dimension*0.25*pi;
> else
>    dimen=0;
> end
> cx=r0+rbar;
> cy=0;
> dx=Rext/(N-1);
> fact=0.2;
> coordxy=[];
> ang=0.25*pi;
> moltip=0.05;
> dang=moltip*dx/Rext;
> fix=[Rext*cos(ang), Rext*sin(ang);Rext,0;r0,0];
> ymax=0;
> if geo==-1,fix=[fix;0,0;hyper+.1 0;hyper+0.1 sqrt(hyper^2 -r0^2);hyper sqrt
> (hyper^2 -r0^2)];end
> if geo==0,fix=[fix;r0*cos(ang) r0*sin(ang)];end
> if geo==1,fix=[fix;0,0;r0+2*rbar,0];end
> if geo==2,fix=[fix;0,0;r0+rbar,0;r0,dimen;r0+rbar,dimen];end
> if geo==3,fix=[fix;0,0;r0+rbar,0;r0*cos(dimen) r0*sin(dimen);(r0+rbar)*cos
> (dimen) (r0+rbar)*sin(dimen)];end
> if geo==4,
>    p1=[r0+dimen;dimen;0];    p2=[r0+dimen;-dimen;0];
>    [mu,inters]=raycircle(p1,p2,[r0+rbar;0],rbar);
>    lint=length(inters);
>    if lint<6, disp('error intersection'),return,end
>    ymin=min([inters(2),inters(5)]);
>    ymax=max([inters(2),inters(5)]);    
>    fix=[fix;0,0;r0+dimen 0;r0+dimen ymax; r0+dimen+thick ymax; r0+dimen+thick 
> 0];
> end
> [p,t,qual]=prova2dr(geo,Rext,r0,ratio,dimen,hyper,dx,fix,ymax,thick);
> %pause
> 
> ////////////////////////////////////////////////////////////////////////////////////////////////////
> function with the error
> function [p,t,qual]=dr(geo,Rext,rr0,ratio,dimen,hyper,dx,fix,yint,thick);
> 
> global Rext rr0 rbar c dimen hyper yint thick
> 
> rand('state',111); % Always the same results
> 
> set(gcf,'rend','z');
> 
> rbar=rr0*ratio;
> c=rr0+rbar;
> 
> lbox = Rext * [0, -1; 1, 1]
> 
> /////////////////////////////////////////////////////////////////////////////////////////////////////////

The original error given by Octave indicated that Rext is empty. Looking at the 
script and function you provided the problem is that you haven't specified Rext 
to be global when the original script was run (the one you call "original 
mfile"). What happens if you first type ...

        global Rext rr0 rbar c dimen hyper yint thick

... and then run your "original mfile"?

Ben

p.s. when you reply, please "reply-all" and respond at the bottom to make it 
easier for others to follow along. Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]