Unrecognized function or variable 'phload.'

조회 수: 1 (최근 30일)
Rachel Dawn
Rachel Dawn 2020년 10월 27일
댓글: Rachel Dawn 2020년 10월 27일
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
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
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.
  댓글 수: 1
Rachel Dawn
Rachel Dawn 2020년 10월 27일
how are you so good at ths stuff? thanks!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by