Unrecognized function or variable 'phload.'
1 次查看(过去 30 天)
显示 更早的评论
numdesigns=5
nelx=30;
nely=30;
for i=1:numdesigns
volfrac=round((.3+(.8-.3)*rand(1,1)),1); %random # from .3 to .8
penal=3; %paper said "typically 3"
rmin=round((1.2+(1.5-1.2)*rand(1,1)),1); %filter size- range or?
%primary load is set to -1 (and applied at bottom right of beam)
%phantom load randomly changes magnitude + location
%added code lines 91+
phload=round((.1+(.3-.1)*rand(1,1)),2); %random magnitude from 0.1 to 0.3
phlocation=randi([round(2*(nelx+1)/3) nelx+1], 1,1); %from 2/3 beam to right end
toploadph(nelx,nely,volfrac,penal,rmin, phload, phlocation)
end
I get that both phload and phlocation are unrecognized. don't know why.
the beginning of the function looks like this:
function toploadph(nelx,nely,volfrac,penal,rmin, phload, phlocation);
Error says this:
Unrecognized function or variable 'phload'.
Error in toploadph>FE (line 94)
F(2*nelx*(phlocation-1)+ 2,2)=phload; %location represents vertical columns
Error in toploadph (line 16)
[U]=FE(nelx,nely,x,penal);
Error in generatetop99 (line 64)
toploadph(nelx,nely,volfrac,penal,rmin, phload, phlocation)
1 个评论
Sudhakar Shinde
2020-10-27
编辑:Sudhakar Shinde
2020-10-27
Make sure there is no any 'clear' command used. Check if unfortunately this varible get cleared by any way.
回答(1 个)
Walter Roberson
2020-10-27
You are passing phload into toploadph, but toploadph is not passing it into FE which needs it.
We can also predict that FE is not a nested function within toploadph -- if it were nested, then it would have access to the parameters passed in to the nesting function.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!