How can I get rid of this error? Please help me guys
Show older comments
E = 10e7; poisson = 0.30;
C=E/(1-poisson^2)*[1 poisson 0;poisson 1 0;0 0 (1-poisson)/2];
P = 1e6;
Lx=5; Ly=1;
numberElementsX=20;
numberElementsY=10;
numberElements=numberElementsX*numberElementsY;
[nodeCoordinates, elementNodes] =rectangularMesh(Lx,Ly,numberElementsX,numberElementsY);
xx=nodeCoordinates(:,1);
yy=nodeCoordinates(:,2);
drawingMesh(nodeCoordinates,elementNodes,'Q4','k-');
numberNodes=size(xx,1);
GDof=2*numberNodes;
stiffness=formStiffness2D(GDof,numberElements,elementNodes,numberNodes,nodeCoordinates,C,1,1); % boundary conditions
fixedNodeX=find(nodeCoordinates(:,1)==0);
fixedNodeY=find(nodeCoordinates(:,1)==0); % fixed in YY
prescribedDof=[fixedNodeX; fixedNodeY+numberNodes];
force=zeros(GDof,1);
rightBord=find(nodeCoordinates(:,1)==Lx);
force(rightBord+numberNodes)=P*Ly/numberElementsY;
force(rightBord(1)+numberNodes)=P*Ly/numberElementsY/2;
force(rightBord(end)+numberNodes)=P*Ly/numberElementsY/2;
displacements=solution(GDof,prescribedDof,stiffness,force);
% displacements and deformed shape
disp('Displacements')
jj=1:GDof; format f=[jj; displacements'];
fprintf('node U\n') fprintf('%3d %12.8f\n',f)
UX=displacements(1:numberNodes); UY=displacements(numberNodes+1:GDof);
scaleFactor=0.1; figure
drawingField(nodeCoordinates+scaleFactor*[UX UY],elementNodes,'Q4',UX);%U XX hold on
drawingMesh(nodeCoordinates+scaleFactor*[UX UY],elementNodes,'Q4','k-');
drawingMesh(nodeCoordinates,elementNodes,'Q4','k--');
colorbar
title('U XX (on deformed shape)')
axis off
% stresses at nodes stresses2D(GDof,numberElements,elementNodes,numberNodes,nodeCoordinates,displacements,UX,UY,C,scaleFactor);
''Undefined function or variable "nodeCoordinates".''
[nodeCoordinates, elementNodes] =rectangularMesh(Lx,Ly,numberElementsX,numberElementsY);
6 Comments
loukmane el khaldi
on 18 Apr 2019
Dear ISLAM
I have same problem can you help me please thanks
Walter Roberson
on 18 Apr 2019
What happened after you downloaded the code from the springer site and added the directory to your path?
aspa michaleli
on 29 Oct 2019
Moved: DGM
on 24 Feb 2023
Hello to you all i have the same problem and i can not find anywhere the function drawingField and the drawingMesh from the above problem. Does anyone have solved it ???? i need it for my thesis.
Thanks
ni
on 24 Feb 2023
Dear friend,I want to know how this drawingmesh function is implemented
Walter Roberson
on 24 Feb 2023
It has a switch on the requested element type, and calls plot3() or patch() as appropriate.
Answers (2)
John D'Errico
on 10 Apr 2015
READ THE ERROR MESSAGE.
So where in this script have you defined the variable nodeCoordinatea?
It was generated by rectangularMesh, a code that is NOT supplied by MathWorks. Try this:
which rectangularMesh -all
Do you have that function? If not, then you will need to download it, as well as its companions from this site:
4 Comments
Godfrey Babu
on 20 Sep 2018
Hey John do you have these functions from that book for Windows? Will be greatly appreciated. Thanks
John D'Errico
on 20 Sep 2018
Why would I have them? All I did was use Google search.
The link I gave takes you to a page where you can download the files. I just tried it, and it indeed seems to download files. So surely you can click for yourself just as easily.
loukmane el khaldi
on 14 May 2019
I downloaded the files and I tried to execute this file: rectangular Mesh.p but this message appears "Warning: The P-code file MATLABsoftware_rectangularMesh.p was generated prior to MATLAB version 7.5 (R2007b) and will Use MATLABsoftware_rectangularMesh.p using MATLAB R2007b or later. " How do I correct this error? Help me please.
Walter Roberson
on 14 May 2019
You can hope that nothing bad happens, but if it fails then you would have to go back go Springer to ask them to update the file, which they would pass along to the author of the book. However I would tend to doubt there would be any actual result.
Alternately if you do not have a Student license (not sure about a Home license) then you can probably use your existing license to access MATLAB R2007a and run the code with that.
waqas
on 26 Aug 2019
You can use following rectangularMesh function to generate the same parameters. I hope this works for your code.
function [nodeCoordinates,elementNodes] = rectangularMesh(Lx,Ly,...
numberElementsX,numberElementsY)
xx = 0:Lx/numberElementsX:Lx;
yy = 0:Ly/numberElementsY:Ly;
[XX YY] = meshgrid(yy,xx);
nodeCoordinates = [YY(:),XX(:)];
elementNodes = zeros(numberElementsX*numberElementsY,4);
j = 1;
i =1;
i1 =0;
counter = 0;
for j = 1:numberElementsY
for i =1: numberElementsX
counter = counter +1;
if i ==1 && j==1
i1 =1;
else
i1 = i1 +1;
end
i2 = i1 + 1;
i4 = i1 + numberElementsX + 1;
i3 = i2 + numberElementsX + 1;
elementNodes(counter,:) = [i1 i2 i3 i4];
end
i1 = i1+1;i2 = i2+1;
end
end
8 Comments
priyanka meena
on 1 Feb 2021
Thanks a lot
quy hoang
on 13 May 2021
you have function drawingMesh??
Walter Roberson
on 13 May 2021
Edited: Walter Roberson
on 18 Aug 2021
quy hoang
on 13 May 2021
D:\testchunhat\Newfolder\FerreiraCodes_Improved-master\drawingMesh.p was generated prior to MATLAB version 7.5 (R2007b) and is no longer supported. Use pcode to regenerate the file using MATLAB R2007b or later.
I think rawingMesh.p don't run in matlab 2021? You can help me aboud error?
Steven Lord
on 13 May 2021
You should ask the author and/or the maintainer of the code to regenerate the P-code file in a newer release.
Walter Roberson
on 13 May 2021
https://www.springer.com/us/book/9783030479510 seems to be a 2020 version of the book, so you could probably get updated copies.
Aravinthan Chakarapani
on 8 Nov 2021
Hi there Waqas!
How did you get the codes for rectangularmesh? If you wrote it yourself, do you also happen to have codes suitable for drawingmesh?
waqas
on 10 Nov 2021
Hi Arvinthan,
Yes I wrote the code myself for the rectangular mesh. I dont remember writing a drawingmesh.
Categories
Find more on Univariate Discrete Distributions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!