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 日
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!

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by