In Julia you use [] for dereference. So changes things to K[udofs,:]=0 . Comments are #. Semicolins aren't necessary in scripts.
You might want to check out this page of the manual: http://docs.julialang.org/en/release-0.4/manual/noteworthy-differences/ On Tuesday, August 23, 2016 at 9:29:52 PM UTC-7, Nguyen Vinh Phu wrote: > > Hello all, > > I am implementing a finite element solver in Julia. I have computed the > stiffness matrix (as a sparse matrix K) and the force vector (F). I have > some non zero boundary conditions on > the unknown. In Matlab, here is what I do: > > bcwt=mean(diag(K)); % a measure of the average size of an element in K > % used to keep the conditioning of the K matrix > udofs=fixedNode; % global indecies of the fixed displacements > f=f-K(:,udofs)*uFixed; % modify the force vector > K(udofs,:)=0; > K(:,udofs)=0; > K(udofs,udofs)=bcwt*speye(length(udofs)); % put ones*bcwt on the diagonal > f(udofs)=bcwt*speye(length(udofs))*uFixed; > U=K\f; > > I implemented the above in Julia and I got several errors associated with > the following > > f=f-K(:,udofs)*uFixed; % modify the force vector > K(udofs,:)=0; > K(:,udofs)=0; > K(udofs,udofs)=bcwt*speye(length(udofs)); % put ones*bcwt on the diagonal > f(udofs)=bcwt*speye(length(udofs))*uFixed; > > I would appreciate very much if someone can help. Thanks. > > Best regards, > Phu > >